|
监控LINUX平台,需要NRPE,可以在www.nagios.org下载
1.在nagios服务器端安装NRPE,
tar xzf nrpe-2.8.1.tar.gz
cd nrpe-2.8.1
./configure
make all
make install-plugin
在command.cfg里定义check_nrpe命令
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
2.在nagios客户端安装NRPE,
/usr/sbin/useradd nagios
passwd nagios
tar xzf nagios-plugins-1.4.9.tar.gz
cd nagios-plugins-1.4.9
./configure --prefix=/usr/local/nagios
make && make install
chown nagios.nagios /usr/local/nagios/
chown -R nagios.nagios /usr/local/nagios/libexec/
tar xzf nrpe-2.8.1.tar.gz
cd nrpe-2.8.1
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
修改/etc/nrpe.cfg allow_hosts 加上nagios服务器IP
启动NRPE daemon /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
可以把以上命令写入rc.local,开机自动启动,当然,在FW中要开放5666端口
3.验证
在本机,/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
在远程, /usr/local/nagios/libexec/check_nrpe -H client ip
返回NRPE版本号,测试成功
4.监控
创建一个CFG文件,rhel.cfg,把rhel.cfg加入nagios.cfg的windows server 下,其实位置不重要,编辑rhel.cfg
define host {
use linux-server
host_name RING-1
alias RING-1
address 192.168.0.11
}
其中use linux-server 为template.cfg中定义。
define service {
use generic-service
host_name RING-1,RING-2,RING-3,RING-4,RING-5
service_description CPU Load
check_command check_nrpe!check_load
} |
|