nagios

/usr/local/nagios/libexec/check_nrpe -H localhost
会返回当前NRPE的版本
[root@dbpi nrpe-2.8.1]# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.8.1

也就是在本地用check_nrpe连接nrpe daemon是正常的
注:为了后面工作的顺利进行,注意本地防火墙要打开5666能让外部的监控机访问


command_name check_nrpe
定义命令名称为check_nrpe,在services.cfg中要使用这个名称.
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
这是定义实际运行的插件程序.这个命令行的书写要完全按照check_nrpe这个命令的用法.不知道用法的就用check_nrpe –h查看 

nrpe.cfg----------------------------------

command[check_disk1]=/usr/local/nagios/libexec/check_disk -w 30% -c 20% -p /
command[check_disk2]=/usr/local/nagios/libexec/check_disk -w 30% -c 20% -p /data
command[check_http]=/usr/local/nagios/libexec/check_http -H 222.73.85.214 -p 80 -c 3 -t 2
command[check_ping]=/usr/local/nagios/libexec/check_ping -w 100,20% -c 200,50% -t 5 -H 211.144.85.123
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 30% -c 20%
 iptables------------------------------------

#!/bin/bash
iptables -I INPUT -s 8.8.8.8 -p tcp --dport 5666 -j ACCEPT
service iptables save
useradd -M -s /sbin/nologin nagios
rpm -ivh nagios-plugins-1.4.14-1.el5.x86_64.rpm
rpm -ivh nrpe-2.12-12.el5.x86_64.rpm
mkdir -p /usr/local/nagios/libexec
cp -p ./check* /usr/local/nagios/libexec
\cp nrpe.cfg /etc/nagios/nrpe.cfg
sed -i 's/113.195.145.67//g' /etc/nagios/nrpe.cfg
chown -R nagios.nagios /usr/local/nagios
service nrpe start

被控端需开放5666端口

你可能感兴趣的:(nagios)