NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with Windows agent addons like NSClient++, so you can check metrics on remote Windows machines as well.
Download the required plugin from the below url’s,
Download link for NRPE :
http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-Nagios-Remote-Plugin-Executor/details
Download link for Nagios plugins:
http://www.nagios.org/download/plugins
NRPE INSTALLATION STEPS
1. To install Nagios plugins
Nagios user is needed for every end system so that the nagios server will prompt the end systems to execute the commands/plugins as the nagios user,
Note: Please follow the below steps as a root user
#sudo su (or) su - root
# useradd nagios
# passwd nagios
ssl libraries are required as a dependency to nrpe addon, and we can install it by providing the below command
# yum install openssl openssl-devel
Traverse to the downloaded plugin directory, and follow the steps
# cd nagios-plugins-2.*/
# ./configure
# make
# make install
# chown nagios:nagios /usr/local/nagios
# chown nagios:nagios /usr/local/nagios/libexec/ -R
# yum install xinetd
2. To Install NRPE addon
Traverse to the downloaded nrpe directory, and follow the steps
# cd nrpe-2.15
# ./configure
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd
Open the below file and add the nagios server ip to allow the nrpe request:
# vim /etc/xinetd.d/nrpe
Add the following entry for the NRPE daemon to the /etc/services file:
nrpe 5666/tcp # NRPE
Restart the xinetd service:
# service xinetd restart (or) /etc/init.d/xinetd restart
check whether the nrpe port (5666) is listening
# netstat -at | grep nrpe
Verify the NRPE add-on it should provide output like below:
# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v2.15
After all that, configure your own scripts to monitor the instances or download the checks from nagios exchange
After Downloading and editing the scripts, you can edit /usr/local/nagios/etc/nrpe.cfg file to add monitoring for the services
PNP4NAGIOS INSTALLATION STEPS
PNP is an addon to nagios which analyzes performance data provided by plugins and stores them automatically into RRD-databases.
Prerequisites:
# yum -y install rrdtool rrdtool-perl php-gd
Downloading and compiling pnp4nagios:
# cd ~/Downloads
# wget http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.21.tar.gz
Installation of pnp4nagios:
# tar -zxvf pnp4nagios-0.6.21.tar.gz
# cd pnp4nagios-0.6.21
# ./configure
# ./configure --with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perl_lib_path=/usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi
# make all
# make install
# make install-webconf
# make install-config
Change the Main Configuration file nagios.cfg to work with pnp4nagios:
# vim /usr/local/nagios/etc/nagios.cfg
1.Add the below lines in nagios.cfg
process_performance_data=1
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.x
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
2.Add commands in object configuration.
# vim usr/local/nagios/etc/objects/commands.cfg
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
To create shortcut for pnp near host with popup in Web UI
Prerequisites:
PNP is installed
Copy the file status-header.ssi from the contrib/ssi/ folder of the PNP package to /usr/local/nagios/share/ssi/.
Attention: This file must NOT be executable. Otherwise it will be treated as a CGI which will result in an error.
Add action_url directive to the templates
# vim /usr/local/nagios/etc/objects/templates.cfg
For Host templates:
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_'class='tips'rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
For Service Templates:
action_url
/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$'class='tips'rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
Run the below command to collect the data:
/usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg
Restart apache and nagios to run with new changes:
# /etc/init.d/nagios restart
# /etc/init.d/httpd restart
Open pnp4nagios web page by entering
http://localhost/pnp4nagios/
After your environment passed all requirements . You need to delete install.php file.
# rm -rf /usr/local/pnp4nagios/share/install.php
You have successfully installed NRPE addon and PNP4Nagios.