Welcome 微信登录

首页 / 操作系统 / Linux / Nagios之Nrpe 插件安装教程

Nagios之Nrpe 插件安装教程一.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 restartNagios报错NRPE: Command "check_heartbeat" not defined  http://www.linuxidc.com/Linux/2015-02/112672.htm如何用Nagios远程执行插件(NRPE)来检测服务器内存使用率  http://www.linuxidc.com/Linux/2014-11/108859.htmNginx环境下构建Nagios监控平台 http://www.linuxidc.com/Linux/2011-07/38112.htm在RHEL5.3上配置基本的Nagios系统(使用Nagios-3.1.2) http://www.linuxidc.com/Linux/2011-07/38129.htmCentOS 5.5+Nginx+Nagios监控端和被控端安装配置指南 http://www.linuxidc.com/Linux/2011-09/44018.htmUbuntu 13.10 Server 安装 Nagios Core 网络监控运用 http://www.linuxidc.com/Linux/2013-11/93047.htmNagios 的详细介绍:请点这里
Nagios 的下载地址:请点这里本文永久更新链接地址