The Nagios is a very helpful monitoring tool to the remote machines, we can Install and Configure NRPE in CentOS and Red Hat OS. Once you have installing NRPE daemon on the machine that needs monitoring like,
Host Status
Disk Space
Port Monitoring
Website content Monitoring
SSH
Email queues status
Mysql Status
System Load average and more...
The following steps how to configure NRPE in the client system
Before start, supporting packages and nagios plugins must be installed on the remote machine,
# yum -y update
# yum -y install gcc
# yum -y install perl
# yum -y install libtool
# yum -y install openssl-devel
# yum -y install gcc
# yum -y install perl
# yum -y install libtool
# yum -y install openssl-devel
Create a nagios user
#useradd nagios
downlaod the nagios plugin and nrpe
# cd /root/download
# wget http://assets.nagios.com/downloads/nagiosplugins/nagios-plugins-1.5.tar.gz
# wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
# tar -xf nagios-plugins-1.5.tar.gz
# cd nagios-plugins-1.5
# ./configure
....
--with-apt-get-command:
--with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
--with-ping-command: /bin/ping -n -U -w %d -c %d %s
--with-ipv6: yes
--with-mysql: no
--with-openssl: no
--with-gnutls: no
--enable-extra-opts: no
--with-perl: /usr/bin/perl
...
# make
# make install
# chown nagios.nagios /usr/local/nagios
# chown -R nagios.nagios /usr/local/nagios/libexec
# wget http://assets.nagios.com/downloads/nagiosplugins/nagios-plugins-1.5.tar.gz
# wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
# tar -xf nagios-plugins-1.5.tar.gz
# cd nagios-plugins-1.5
# ./configure
....
--with-apt-get-command:
--with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
--with-ping-command: /bin/ping -n -U -w %d -c %d %s
--with-ipv6: yes
--with-mysql: no
--with-openssl: no
--with-gnutls: no
--enable-extra-opts: no
--with-perl: /usr/bin/perl
...
# make
# make install
# chown nagios.nagios /usr/local/nagios
# chown -R nagios.nagios /usr/local/nagios/libexec
Next, install xinetd using yum command.
# yum install xinetd
Configure nrpe :
# tar -xf nrpe-2.15.tar.gz
# cd nrpe-2.15
# ./configure
*** Configuration summary for nrpe 2.15 09-06-2013 ***:
General Options:
----------------
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios
Review the options above for accuracy. If they look okay,
type 'make all' to compile the NRPE daemon and client.
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd
# cd nrpe-2.15
# ./configure
*** Configuration summary for nrpe 2.15 09-06-2013 ***:
General Options:
----------------
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios
Review the options above for accuracy. If they look okay,
type 'make all' to compile the NRPE daemon and client.
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd
Note : Assume that the Nagios IP address is 192.168.0.100
open nrpe file and add nagios IP Address
# vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1 192.168.0.100
# vi /etc/services
5666 /tcp # NRPE
only_from = 127.0.0.1 192.168.0.100
# vi /etc/services
5666 /tcp # NRPE
Next, you want to configure nrpe.cfg files
# vi /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1 192.168.0.100
command[check_hosts]=/usr/local/nagios/libexec/check_ping -H 192.168.0.200 -w 3000.0,80% -c 5000.0,100% -p 5
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_xvda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
command[check_http]=/usr/local/nagios/libexec/check_http -I 192.168.0.200 -p 80
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -u nagios -p nagios -H 192.168.0.200 -P 3306
allowed_hosts=127.0.0.1 192.168.0.100
command[check_hosts]=/usr/local/nagios/libexec/check_ping -H 192.168.0.200 -w 3000.0,80% -c 5000.0,100% -p 5
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_xvda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
command[check_http]=/usr/local/nagios/libexec/check_http -I 192.168.0.200 -p 80
command[check_mysql]=/usr/local/nagios/libexec/check_mysql -u nagios -p nagios -H 192.168.0.200 -P 3306
Restart xinetd daemon with service xinetd restart
# /etc/init.d/xinetd start
Starting xinetd: [ OK ]
Starting xinetd: [ OK ]
Test nrpe is functional ?
# netstat -at | grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
tcp 0 0 *:nrpe *:* LISTEN
Port number allow in IP tables, If are you using Fedora/CentOS/RedHat
iptables -I RH-Firewall-1-INPUT -p tcp -m tcp -dport 5666 -j ACCEPT
May be have you configured CSF (ConfigServer Firewall) allow the Port
Restart IP Tables or CSF
Finally, check the NRPE Version using below command,
# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15
NRPE v2.15
If you want to check services manually
/usr/local/nagios/libexec/check_users -w 5 -c 10
USERS OK - 4 users currently logged in |users=4;5;10;0
USERS OK - 4 users currently logged in |users=4;5;10;0
I have faced errors while configuring nagios,
Error 1 : "checking for SSL headers... configure: error: Cannot find ssl headers"
Error 2 : connection refused by host in nagios server
The xinetd services does not run
# /etc/init.d/xinetd start
Next, How to Configure Client Machine in Nagios Server.
Comments (0)