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 https://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 https://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

三.测试获取数据

udast

四.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                    -server
        host_name              nrpehost
        alias                  My 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

udast

Nagios报错NRPE: Command ‘check_heartbeat' not defined 

如何用Nagios远程执行插件(NRPE)来检测内存使用率 

Nginx环境下构建Nagios监控平台

在RHEL5.3上配置基本的Nagios系统(使用Nagios-3.1.2)

Nagios 的详细介绍

转载自:https://www.linuxidc.com/Linux/2015-11/125436.htm

声明: 除非转自他站(如有侵权,请联系处理)外,本文采用 BY-NC-SA 协议进行授权 | 智乐兔
转载请注明:转自《Nagios之Nrpe 插件安装教程
本文地址:https://www.zhiletu.com/archives-5310.html
关注公众号:智乐兔

赞赏

wechat pay微信赞赏alipay pay支付宝赞赏

上一篇
下一篇

相关文章

在线留言

你必须 登录后 才能留言!

在线客服
在线客服 X

售前: 点击这里给我发消息
售后: 点击这里给我发消息

智乐兔官微