HowTo Install NRPE on Debian-Host

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
# 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
# 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 =

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.

How To Install Nagios on Ubuntu

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.

Download, install and Configure Apache
first we have to install some necessary compliers and Apache to run Nagios.
run the next commands:
# sudo apt-get install build-essential
# sudo apt-get install libgd2-xpm-dev
# sudo apt-get install apache2
# sudo apt-get install php5-common php5 libapache2-mod-php5

Configure Apache to use PHP:

Run in a terminal:
# sudo vi /etc/apache2/apache2.conf
Paste the following into the file:
DirectoryIndex index.html index.php index.cgi

and restart the server with the command
# sudo /etc/init.d/apache2 restart

Download, install, and configure Nagios
Create a user to run the service and a group to run external commands:

# sudo useradd -m nagios
# sudo passwd nagios
# sudo groupadd nagcmd
# sudo usermod -a -G nagcmd nagios
# sudo usermod -a -G nagcmd www-data

Download the current version of Nagios and Nagios Plugins from -

Extract the Nagios tar:
# sudo tar -zxvf nagios-3.1.2.tar.gz
and change to the nagios-3.1.2 directory
# cd  nagios-3.1.2
Now install the Nagios use the flowing commands :
# sudo ./configure --with-command-group=nagcmd
# sudo make all
# sudo make install
# sudo make install-init
# sudo make install-config
# sudo make install-commandmode
# sudo make install-webconf

Add a user for the Nagios interface:
# sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Extract and compile the Nagios-plugins:
# tar -zxvf nagios-plugins-1.4.14.tar.gz
# cd nagios-plugins-1.4.14
# sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# sudo make
# sudo make install

Create a link to start the service:
# sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the config:
# sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Start Nagios:
# sudo /etc/init.d/nagios start

You should now be able to log into the Nagios web interface (http://localhost/nagios) using the nagiosadmin user and password.