HowTo Install NRPE on Debian-Host

Hi,
Later in my last post - How To Install Nagios
I want to show you how to install NRPE plugin on your Debian-Hosts to monitoring from Nagios.

Install NRPE-Daemon and Nagios-Plugins on Debian-Linux Host.

1. Make sure you have a C compiler installed
# apt-get install make gcc g++

2. Install SSL for secure communication between Nagios-Server and Debian-Host
# apt-get install libssl-dev

3. Install SNMP (in case you like to query some SNMP via NRPE)
# apt-get install snmpd
# apt-get install snmp scli tkmib

4. Create Nagios user
# useradd -p nagios nagios

5. Install Nagios-Plugins
# cd /usr/src
# wget http://internode.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
# tar -xzvf nagios-plugins-1.4.13.tar.gz
# cd nagios-plugins-1.4.13
# ./configure
# make
# make install

6. Fix permission for the Nagios director
# chown -R nagios:nagios /usr/local/nagios/

7. Install Xinetd
# apt-get install xinetd

8. Install and configure NRPE
# cd /usr/src
# wget http://waix.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
# 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
# vi /etc/xinetd.d/nrpe
and add to only_from= your Nagios server IP
only_from = 127.0.0.1 192.168.1.101

Add the following entry for the NRPE daemon to the /etc/services file.
# echo "nrpe 5666/tcp #NRPE" >> /etc/services

Restart the NRPE service
# /etc/init.d/xinetd restart

Test if NRPE is listening:
# netstat -l | grep nrpe

The output out this command should show something like this:
tcp 0 0 *:nrpe *:* LISTEN

Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that was installed for testing purposes.
# /usr/local/nagios/libexec/check_nrpe -H localhost

If everything is fine you will see this output:
NRPE v2.12

9. Test the NRPE from the Nagios-Server
Now we want to test if we can query some information from the Debian-Host via NRPE from the Nagios-Server.
So switch into /usr/local/nagios/libexec on your Nagios Server and check if you have the check_nrpe plugin.
# ls - l check_ nrpe

In case you dont have the check_nrpe plugin you need to download and compile NRPE. (See Step 8)
run the next command:
# ./check_nrpe -H HostIPAddress -c check_users

You should get something like this back:
USERS OK - 1 users currently logged in |users=1;5;10;0

Great! Your Nagios server is able to communicate with the Debian-Host.

4 comments:

  1. great post - thanks

    ReplyDelete
  2. great stuff,still does the trick. Thanks

    ReplyDelete
  3. Superb notes, does what it says on the tin ;)

    ReplyDelete