……
在监控主机端安装check_nrpe插件
[root@monitor ~]# tar xzvf nrpe-2.14.tar.gz [root@monitor ~]# cd nrpe-2.14 [root@monitor nrpe-2.14]# ./configure [root@monitor nrpe-2.14]# make all [root@monitor nrpe-2.14]# make install-plugin
[root@monitor nrpe-2.14]# ls /usr/local/nagios/libexec/check_nrpe /usr/local/nagios/libexec/check_nrpe [root@monitor nrpe-2.14]#
在被监控主机端安装nagios plugin与nrpe daemon
[root@localhost nrpe-2.14]# useradd nagios -s /sbin/nologin
安装nagios plugin
[root@localhost nagios-plugins-1.4.16]# ./configure
[root@localhost nagios-plugins-1.4.16]# make
[root@localhost nagios-plugins-1.4.16]# make install
[root@localhost nagios-plugins-1.4.16]# chown -R nagios.nagios /usr/local/nagios/
[root@localhost nrpe-2.14]# yum install gcc make openssl-devel
[root@localhost ~]# yum install xinetd
[root@localhost nrpe-2.14]# ./configure
[root@localhost nrpe-2.14]# make
[root@localhost nrpe-2.14]# make install
[root@localhost nrpe-2.14]# make install-daemon
[root@localhost nrpe-2.14]# make install-daemon-config
[root@localhost nrpe-2.14]# make install-xinetd
修改配置文件中NRPE监听的监控主机IP地址
[root@localhost nrpe-2.14]# vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1
[root@localhost nrpe-2.14]# vi /etc/services
nrpe 5666/tcp # NRPE Daemon
[root@localhost nrpe-2.14]# service xinetd start
Starting xinetd: [ OK ]
[root@localhost nrpe-2.14]#
[root@localhost nrpe-2.14]# netstat -at |grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
[root@localhost nrpe-2.14]#
[root@localhost nrpe-2.14]# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.14
[root@localhost nrpe-2.14]#
在监控主机使用命令检测被监控主机当前登录用户数量
[root@monitor libexec]# ./check_nrpe -H 192.168.1.90 -c check_users
USERS OK – 1 users currently logged in |users=1;5;10;0
[root@monitor libexec]#
使用NRPE需要定义被监控主机所使用的命令
[root@localhost nrpe-2.14]# vi /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_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
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 150 -c 200
在监控主机创建check_nrpe命令定义
# ‘check_nrpe’ command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
增加被监控主机的监控服务定义
[root@monitor etc]# vi servers/szvs-v01.cfg
define service{
use generic-service
host_name szvs-v01
service_description Current Users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name szvs-v01
service_description CPU Load
check_command check_nrpe!check_load
}
相关下载:
(1) NRPE 2.14