|
注:这里我的测试linux-server主机的IP是192.168.1.105,window-2003主机的IP是192.168.1.40,nagios服务机的IP地址为192.168.1.100
一、对linux的监控:
相关软件:nagios-plugins-1.4.13.tar,nrpe-2.12.tar
1、添加相关用户:
#groupadd nagios
#useradd -g nagios -s /sbin/nologin nagios
2、安装: nagios-plugins-1.4.13.tar(注意gcc要先安装)
#mkdir /usr/local/nagios
#chown -R nagios.nagios /usr/local/nagios
#tar xzvf nagios-plugins-1.4.13.tar.gz
#cd nagios-plugins-1.4.15
#./configure --/usr/local/nagios
#make&&make install
安装:
#tar xzvf nrpe-2.9.tar.gz
#cd nrpe-2.9
#./configure --with-command-group=nagios --prefix=/usr/local/nagios
(如果报缺少ssl,请安装 yum install openssl-devel)
#make all
#make install-plugin
#make install-daemon
#make install-daemon-config
#make install-daemon-xinetd //将nrpe的启动交给xinetd管理
配置nrpe:
a、vi /etc/xinetd.d/nrpe
service nrpe{
.......
port=5666
only_from=IP地址(nagios主服务的主机IP地址)
}
b、vi /etc/service
添加:
nrpe 5666/tcp
c、重启xinetd服务
#service xinetd restart
检测nrpe是否开启#netstat -tulnp | grep 5666
如果有侦听,则说明开启成功,否则请从日志里开始查询哪里出了问题。
二、对window-2003主机监控
软件包:NSClient0.3.5-Win32、NSClient0.3.5-Win32
安装:将NSClient0.3.5-Win32解压到C:盘根目录下
从命令行下安装:
如:在CMD下,进入cd C:\ NSClient0.3.5-Win32>
C:\ NSClient0.3.5-Win32>NSClient++ /install
配置:到安装目录打开NSC.ini文件进行修改:
在[modules]模块,将除CheckWMI.dll和RemoteConfiguration.dll外的所有dll文件明前的注释(;)去掉。
port=12489 #去掉注释就可以了!
在[Settings]模块可以设置一个连接密码password=PWD,为了简单,在此不设密码。设置 allowed_hosts=127.0.0.1/32,192.168.1.100,可以连接的监控服务器的地址。
启动服务:
运行:services.msc
打开:NSClient服务,选择启动。
并且:NSClient++ /start
检查服务是否开启:
netstat -an
当:0.0.0.0:12489侦听时,即说明开启成功。
到此,这两个客户端安装、配置基本实现。
三、在服务端的配置:在service.cfg和hosts.cfg文件配置。具体在上一个nagios服务器端配置上有介绍。
效果载图以后再补。
|
|