Nagios监控Linux服务器
一、客户端
安装所需的软件(nagios-plugins、nrpe)
#wget
#wget
1、安装nagios-plugins
#增加一个用户
useradd nagios -s /sbin/nologin -M
解压并安装
#tar zvxf nagios-plugins-1.4.16.tar.gz && cd nagios-plugins-1.4.16
#./configure --with-nagios-user=nagios --with-nagios-group=nagios && make && make install
#chown -R nagios:nagios /usr/local/nagios
2、安装nrpe
#tar -zxvf nrpe-2.13.tar.gz && cd nrpe-2.13
#./configure --enable-ssl --with-ssl-lib (前提是已经安装了openssl与openssl-devel)
#make all && make install-plugin && make install-daemon && make install-daemon-config
3、配置nrpe
配置nrpe信息
#vim /usr/local/nagios/etc/nrpe.cfg,查找并修改如下一行
allowed_hosts=172.16.17.223,127.0.0.1 #注意修改为nagios服务器的IP:172.16.17.223
#配置监控对象
说明:由监控原理可知被监控端做监控,然后将数据传给监控服务器绘总,设置监控详细参数主要是设置被监控端的nrpe.cfg文件,可以看到里面监控对象
vim /usr/local/nagios/etc/nrpe.cfg,查找并修改如下一行
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 10% -c 5%
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 500 -c 550
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_ping]=/usr/local/nagios/libexec/check_ping -H 192.168.1.1 -w 100.0,20% -c 500.0,60%
后两行是自添加的
4、启动nrpe,并测试
#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
#echo “/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d &> /dev/null” >> /etc/rc.local
#netstat -atulnp | grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 5201/nrpe
#/usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.13
nrpe介绍下载:
具体下载目录在 /2012年资料/7月/13日/Nagios监控Linux服务器/