Install and setup Nagios. Part 2

(0 comments)

NRPE - Nagios Remote Plugin Executor

nrpe

Tasks: 1. Install plugin NRPE Nagios 2. adding host to Nagios for remote monitor hosts, sometime instead SNMP better use Nagios plugins + NRPE

Allows remotely run plugins nagios in Linux/Unix hosts

Download NRPE 2.15 Download nagios-plugins-1.5.tar.gz and extract it

$tar -zxvf nagios-plugins-1.5.tar.gz
$tar zxvf nrpe-2.15.tar.gz
$cd nagios-plugins-1.5

  before compiling we need to create user for run daemon nrpe

$sudo useradd nagios 
$sudo passwd nagios (input strong password!)
$./configure
$make
$sudo make install
$cd /usr/local/nagios/libexec

here should be a lot of files - plugins wich we can run remotely from nagios host , ??? ? ???? Compilling NRPE Go to the dir where extracted nrpe plugin We need OpenSSL for connection between nagios host and remote host

$sudo apt-get install libssl-dev

$./configure --with-ssl-lib=/usr/lib/x86_64-linux-gnu if need help:

$./configure -help

After success install we see:

*** Configuration summary for nrpe 2.15 09-06-2013 ***:

General Options:
-------------------------
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios

Review the options above for accuracy. If they look okay,
type 'make all' to compile the NRPE daemon and client.
$make all
$sudo make install-plugin
$sudo make install-daemon
$sudo make install-daemon-config

We need edit config file

/usr/local/nagios/etc/nrpe.cfg

looking for the line:

#server_address=127.0.0.1 # change to remote host ip

this is host with nrep plugin, change on actual IP, uncomment it and change to nagios host IP:

 allowed_hosts=127.0.0.1 #change to nagios IP 

Go to bottom :

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

in [ .. ] this is command witch used in nagios host in config file. we can use any plugins in this directory /usr/local/nagios/libexec also we can use own plugins. we can change values as we want: /dev/sda6 /dev/sdb3 are in our server

command[check_sda6]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda6
command[check_sdb3]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sdb3

here should be your disks run nrpe as daemon in remote host: $sudo /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d check nrpe on 5666 port:

$ sudo netstat -anp |grep nrpe
tcp 0 0 127.0.0.1:5666 0.0.0.0:* LISTEN 27377/nrpe

All are OK. Go to in nagios host console and check connectivity with remote host

/usr/local/nagios/libexec/check_nrpe -H <ip remote host>
NRPE v2.15

OK. Configure config file for using nrpe for this remote host

define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name rec-1
alias rec-1
address 192.168.1.28  #here ip address remote host with nrpe plugin
}

define service{
use generic-service ; Name of service template to use
host_name rec-1
service_description Total Processes
check_command check_nrpe!check_total_procs
}
define service{
use generic-service ; Name of service template to use
host_name rec-1
service_description Current Load
check_command check_nrpe!check_load
}

define service{
use generic-service ; Name of service template to use
host_name rec-1
service_description Free Space /lasxdays2
check_command check_nrpe!check_sda6
}

define service{
use generic-service ; Name of service template to use
host_name rec-1
service_description Free Space /lastxdays3
check_command check_nrpe!check_sdb3
}

Then restart nagios: #service nagios restart Now we check available space in remote host /dev/sda6 /dev/sdb3 if something wrong alerts to admins. End.

Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required