歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Nagios之Nrpe 插件安裝教程

Nagios之Nrpe 插件安裝教程

日期:2017/2/28 13:56:23   编辑:Linux教程

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 restart

Nagios報錯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.htm

Nginx環境下構建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.htm

CentOS 5.5+Nginx+Nagios監控端和被控端安裝配置指南 http://www.linuxidc.com/Linux/2011-09/44018.htm

Ubuntu 13.10 Server 安裝 Nagios Core 網絡監控運用 http://www.linuxidc.com/Linux/2013-11/93047.htm

Nagios 的詳細介紹:請點這裡
Nagios 的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved