Nrpe 插件安装教程

Nrpe 插件安装教程

 blog地址: http://www.cnblogs.com/caoguo

 

一.nagios plugins的安装

[root@Nrpe ~]# yum install -y gcc openssl-devel
[root@Nrpe ~]# /usr/sbin/useradd -m nagios

[root@Nrpe ~]# cd /usr/local/src
[root@Nrpe src]# wget http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz

[root@Nrpe src]# tar xzf nagios-plugins-2.1.1.tar.gz 
[root@Nrpe src]# cd nagios-plugins-2.1.1
[root@Nrpe nagios-plugins-2.1.1]# ./configure --prefix=/usr/local/nrpe --with-nagios-user=nagios --with-nagios-group=nagios
[root@Nrpe nagios-plugins-2.1.1]# make && make install

 

二.nrpe 服务安装

[root@Nrpe src]# wget http://nchc.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
[root@Nrpe src]# tar zxf nrpe-2.15.tar.gz 
[root@Nrpe src]# cd nrpe-2.15
[root@Nrpe nrpe-2.15]# ./configure --prefix=/usr/local/nrpe
[root@Nrpe nrpe-2.15]# make all
[root@Nrpe nrpe-2.15]# make install-plugin
[root@Nrpe nrpe-2.15]# make install-daemon
[root@Nrpe nrpe-2.15]# make install-daemon-config

[root@Nrpe ~]# ln -s /usr/local/nrpe/etc /etc/nrpe
[root@Nrpe ~]# cp -rf /etc/nrpe/nrpe.cfg /etc/nrpe/nrpe.cfg.old
[root@Nrpe ~]# grep -v -E '^#|^$' /etc/nrpe/nrpe.cfg
log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,192.168.88.138
 
dont_blame_nrpe=0
allow_bash_command_substitution=0
debug=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/local/nrpe/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nrpe/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_sda]=/usr/local/nrpe/libexec/check_disk -w 20% -c 10% -p /dev/sda
command[check_zombie_procs]=/usr/local/nrpe/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nrpe/libexec/check_procs -w 150 -c 200


##########
# 测试启动
# /usr/local/nrpe/bin/nrpe -c /usr/local/nrpe/etc/nrpe.cfg -d

# 自带的启动脚本
[root@Nrpe nrpe-2.15]# cp -rf init-script.in /etc/init.d/nrpe
[root@Nrpe nrpe-2.15]# chmod a+x /etc/init.d/nrpe
[root@Nrpe ~]# chkconfig nrpe on
[root@Nrpe ~]# /etc/init.d/nrpe start

 

三.测试获取数据

 

四.nagios端配置

[root@Nagios ~]# cp /etc/nagios/objects/localhost.cfg /etc/nagios/objects/nrpehost.cfg
[root@Nagios ~]# vi /etc/nagios/objects/nrpehost.cfg
define host{
        use                     linux-server
        host_name               nrpehost
        alias                   My Linux Server
        address                 192.168.88.139
        }

define service{
        use                             generic-service         
        host_name                       nrpehost
        service_description             CHECK USER
    check_command            check_nrpe!check_users
        }

define service{
        use                             generic-service         
        host_name                       nrpehost
        service_description             CHECK LOAD
        check_command                   check_nrpe!check_load
        }

define service{
        use                             generic-service        
        host_name                       nrpehost
        service_description             CHECK SDA
        check_command                   check_nrpe!check_sda
        }

define service{
        use                             generic-service         
        host_name                       nrpehost
        service_description             Zombie
        check_command                   check_nrpe!check_zombie_procs
        }

define service{
        use                             generic-service     
        host_name                       nrpehost
        service_description             Total procs
        check_command                   check_nrpe!check_total_procs
        }
        
[root@Nagios ~]# grep nrpehost /etc/nagios/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/nrpehost.cfg

[root@Nagios ~]# /etc/init.d/nagios restart

 

posted @ 2015-11-20 21:14  ca0guo  阅读(665)  评论(0编辑  收藏  举报