VMware Linux下Nagios监控远程主机的简单设置

snowboy00 2011-11-23

测试的主机为两台虚拟机

vm linux1:192.168.1.122   //作为监控主机

vmlinux2:192.168.1.192   //作为被监控的主机

首先是被监控主机的设置

相关阅读:

[root@localhost ~]# ls nagios-plugins-1.4.15.tar.gz   //安装nagios的套件
nagios-plugins-1.4.15.tar.gz

[root@localhost ~]# tar zxvf nagios-plugins-1.4.15.tar.gz   

[root@localhost nagios-plugins-1.4.15]# useradd -s /sbin/nologin nagios
[root@localhost nagios-plugins-1.4.15]# ./configure

[root@localhost nagios-plugins-1.4.15]# make;make install
[root@localhost nagios-plugins-1.4.15]# cd /usr/local/
[root@localhost local]# chown nagios:nagios nagios/
[root@localhost local]# chown nagios:nagios -R nagios/libexec/
[root@localhost ~]# ls nrpe-2.8b1.tar.gz   //这里就是安装配置nrpe的部分
nrpe-2.8b1.tar.gz
[root@localhost ~]# tar zxvf nrpe-2.8b1.tar.gz

[root@localhost ~]# cd nrpe-2.8b1
[root@localhost nrpe-2.8b1]# ./configure

[root@localhost nrpe-2.8b1]# make all
[root@localhost nrpe-2.8b1]# make install-plugin
[root@localhost nrpe-2.8b1]# make install-daemon
[root@localhost nrpe-2.8b1]# make install-daemon-config
当然啦,你如果英语不错的话,直接参考分包内的说明安装(以下)

[root@localhost nrpe-2.8b1]# ll NRPE.pdf
-rw-rw-r-- 1 nagios nagios 212236 Mar 14  2007 NRPE.pdf

[root@localhost ~]# cd /usr/local/nagios/etc/
[root@localhost etc]# vi nrpe.cfg   //修改主配置档

server_address=192.168.1.192  //被监控主机ip
allowed_hosts=127.0.0.1,192.168.1.122,192.168.1.192  //这里是监控主机的设置,为了检测使用,本机的ip也加上
[root@localhost etc]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d  //启动nrpe这个守护进程
[root@localhost etc]# netstat -tulnp|grep 5666
tcp        0      0 192.168.1.192:5666          0.0.0.0:*                   LISTEN      3384/nrpe 

[root@localhost etc]# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.192  //nrpe是否正常工作时的检测
NRPE v2.8b1

相关推荐