Nagios: Monitor Hosts and Services (Part-3)

Install Check_nrpe plugin in Nagios Server
# cd /tmp
# wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
# tar xzf nrpe-2.15.tar.gz
# cd nrpe-2.15
# yum -y install openssl-devel
# ./configure
# make all
# make install
# make install-daemon

The check_nrpe plugin is now installed in /usr/local/nagios/libexec/

Test check_nrpe plugin
This will test that the check_nrpe plugin is properly installed and can communicate with a remote computer running a NPRE client.
# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.20
Show the message “NRPE v2.15” that means the check_nrpe plugin is working.

For Linux Client End Configuration
# yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel
# useradd -s /sbin/nologin nagios
# passwd nagios

Create a directory for installation and all its future downloads.

# mkdir /root/nagios
# cd /root/nagios
# wget https://www.nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gz
# tar -xvf nagios-plugins-2.1.2.tar.gz
# cd nagios-plugins-2.1.2
# ./configure
# make
# make install
# chown –R nagios.nagios /usr/local/nagios
# yum -y install openssl-devel
# yum install xinetd
# wget https://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
# tar xvf nrpe-2.15.tar.gz
# cd nrpe-2.15
# ./configure
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd

Enter Nagios Server’s IP in this file
# vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1 192.168.1.1

Next, open /etc/services file and add the following entry for the NRPE daemon at the bottom of the file.

nrpe 5666/tcp NRPE

Restart daemon and check it
# systemctl restart xinetd
# netstat -at | grep nrpe
# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.1

We can customize for different purposes. Here for disk space.
# vi /usr/local/nagios/etc/nrpe.cfg
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5

For Multiple partitions:
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5 -w 20% -c 10% -p /dev/sda3 -w 20% -c 10% -p /dev/sda1

For Check_mem ( if it is not available, download first and install as per below )
# wget https://raw.githubusercontent.com/justintime/nagios-plugins/master/check_mem/check_mem.pl
# mv check_mem.pl check_mem
# chmod +x check_mem
# ./check_mem -f -w 20 -c 10
# command[check_mem]=/usr/local/nagios/libexec/check_mem -f -w 20 -c 10
# systemctl restart xinetd
To test after configuration:
# /usr/local/nagios/libexec/check_nrpe -H 192.168.1.20 -c check_mem

If we want to get sound alarm from nagios server then we can follow the below configuration.
For sound notification/alarm, keep audio .wav media files in below location
#/usr/local/nagios/share/media

And add .wav media file name in the below configuration file
# vim /usr/local/nagios/etc/cgi.cfg

host_unreachable_sound=hostdown.wav
host_down_sound=hostdown.wav
service_critical_sound=hostdown.wav
service_warning_sound=hostdown.wav
service_unknown_sound=hostdown.wav

# systemctl restart nagios

See More at Nagios: Monitor Hosts and Services (Part-4)

 

85 total views, 0 views today

Facebook Comments
Share this article to your Social Media