Linux Knowledgebase Portal

Posted on: Oct 17, 2011


Install and configure NRPE

There are several sources on Internet explain how to install and configure NRPE but non of them include an out of the box working solution. Various chmod etc things are missing thus giving you for free plenty of hours troubleshooting a simple HOWTO :)

 

Let's start...
 
 
Step 1 --> Download and install Nagios plugins
 
Download the latest nagios-plugins package direct from Nagios web site.
http://www.nagios.org/download/plugins
 
Example with wget:
wget http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz?r=http%3A%2F%2Fwww.nagios.org%2Fdownload%2Fplugins&ts=1318834296&use_mirror=kent
 
On some Linux distributions (like Debian) the above mirror link might need to be renamed like:
mv nagios-plugins-1.4.15.tar.gz\?r\=http\:%2F%2Fwww.nagios.org%2Fdownload%2Fplugins nagios-plugins-1.4.15.tar.gz
 
Extract the file and cd into the directory:
tar xzvf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
 
Create user nagios:
server1:/usr/local/src# useradd nagios
server1:/usr/local/src# passwd nagios
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
 
Configure & install nagios plugins:
./configure
make
make install
 
Set permissions:
chown  -R nagios:nagios /usr/local/nagios
 
 
Step 2 --> Install and configure NRPE and Xinetd
 
yum install xinetd or apt-get install xinetd if you are on Debian
 
Edit /etc/services and add: nrpe 5666/tcp #NRPE
 
Download NRPE from nagios web site: http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-Nagios-Remote-Plugin-Executor/details
 
Example direct download using wget:
wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz?r=http%3A%2F%2Fexchange.nagios.org%2Fdirectory%2FAddons%2FMonitoring-Agents%2FNRPE--2D-Nagios-Remote-Plugin-Executor%2Fdetails&ts=1318835326&use_mirror=garr
 
In some cases you might need to rename the file like:
mv nrpe-2.12.tar.gz\?r\=http\:%2F%2Fexchange.nagios.org%2Fdirectory%2FAddons%2FMonitoring-Agents%2FNRPE--2D-Nagios-Remote-Plugin-Executor%2Fdetails nrpe-2.12.tar.gz
 
Extract, cd into the directory and install the package:
tar xzvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
 
Edit /etc/xinetd.d/nrpe and replace 127.0.0.1 with your server (where Nagios is running) IP.
 
Restart xinetd: service restart xinetd or /etc/init.d/xinetd restart if you are on Debian, Ubuntu etc.
 
Edit (create if missing and give nagios permissions) /usr/local/nagios/etc/nrpe.cfg and check that allowed_hosts line is something like:
 
allowed_hosts=127.0.0.1,MyServerIP 
 
where MyServerIP is the IP of your Nagios server.
 
Double check the check_disk command to suit your host installation:
 
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/md1
 
In the above example we configured to check our root directory which is on software RAID and on 2nd partition.
 
All done, add some extra services on your host definitions and try out the NRPE in action.