Monday 14 March 2016

Monitoring Linux Hosts with NAGIOS and NRPE

We should firstly install the NRPE agent of the server we wish to monitor:

tar xzf linux-nrpe*
cd linux-nrpe*
sudo ./fullinstall

** Ensure that your firewall on the client allows port 5666 (TCP/NRPE) and 5667(NSCA) inbound connections from your NAGIOS server **

We will then be prompted to enter the IP address of your NAGIOS monitoring server(s.)

Once installed you will find a set of pre-defined commands in /usr/local/nagios/etc/nrpe.cfg - which (of course) we can add additional checks to if required.

Now the next step is too install the NRPE plugin on the NAGIOS server:

tar zxvf nrpe-2.15.tar.gz
cd nrpe-2.15
make all
make install-daemon
make install-plugin

We should also ensure that the relevent checks we wish to perform are uncommented in the following config on the client:


We can now do a quick test of the plugin with:

/usr/local/nagios/bin/nrpe -H

We should proceed by creating the relevent definitons for the new linux host and it's services e.g.:

Add the following lines in nagios.conf

sudo vi /usr/local/nagios/etc/nagios.cfg

# Definitions for monitoring Linux hosts

and then create the linux.cfg file and add our host and service definitions:

sudo vi /usr/local/nagios/etc/objects/linux.cfg

define host{
        use             linux-server  ; Inherit default values from a template
        host_name    ; The name we're giving to this host
        alias           My Linux Server    ; A longer name associated with the host
        max_check_attempts 3
        contacts        NAGIOS Alerting
        address       ; IP address of the host
define service{
            use                             generic-service
            service_description             CPU Load
            check_command                   check_nrpe!check_load
            max_check_attempts              3
            check_interval                  3
            retry_interval                  1
            check_period                    24x7
            notification_interval           30


Post a Comment