Nagios nrpe客户端的安装与配置
1.Nrpe安装
创建 nagios用户
useradd nagios
1.1被监控服务器安装nagios插件
tar xzvfnagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure
make
make install
1.2被监控服务器安装nrpe程序
tar xzvf nrpe-2.1.2.tar.gz
cd nrpe-2.1.2
./configure --prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
检查插件安装
ll /usr/local/nagios/libexec/
1.3修改nrpe配置文件,加入允许的IP
#vi/usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.169.0.201
启动nrpe
#/usr/local/nagios/bin/nrpe -c/usr/local/nagios/etc/nrpe.cfg –d
# netstat -plnt |grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 16831/nrpe
1.4加入开机自启动
echo‘/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d‘>>/etc/rc.local
1.5在主Nagios上验证客户端nrpe是否安装好
[root@nagios-server src]#/usr/local/nagios/libexec/check_nrpe -H 192.168.1.100
NRPE v2.12
若出现版本号,代表nrpe客户端安装成功。
2主Nagios调用nrpe配置
2.1编辑客户端上的nrpe配置文件
#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
2.2在主Nagios上定义客户端主机
#vi /usr/local/nagios/etc/objects/hosts.cfg
define host{
use linux-server,host-pnp
host_name hostb
alias hostb
address 192.168.1.100
}
2.3在主Nagios上配置服务
#vi /usr/local/nagios/etc/objects/services.cfg
define service{
use generic-service,srv-pnp
host_name hostb
service_description check_users
check_command check_nrpe!check_users
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service,srv-pnp
host_name hostb
service_description check_load
check_command check_nrpe!check_load
max_check_attempts 5
normal_check_interval 1
}
2.4重启主Nagios服务
#/etc/init.d/nagios checkconfig
#/etc/init.d/nagios restart
2.5 Nagios界面临控效果图
本文出自 “此心安处是吾乡” 博客,转载请与作者联系!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。