Project

General

Profile

Actions

Setting up NRPE on Debian server » History » Revision 4

« Previous | Revision 4/6 (diff) | Next »
Jamila Khan, 09/02/2016 04:25 PM


Setting up NRPE on Debian server

Process:

on client server

Install NRPE

aptitude install nagios-nrpe-server nagios-plugins-basic

Edit config file

vim /etc/nagios/nrpe.cfg
  • Add IP_v4_of_Nagios_server to allowed_hosts

start service

service nagios-nrpe-server restart

check that service is running

netstat -tpln | grep 5666

edit local config to add specified checks

vim /etc/nagios/nrpe_local.cfg

Add NRPE test check, disk check, and Apache SIGTERM check

0 octavia:/etc/nagios# cat nrpe_local.cfg 
######################################
# Do any local nrpe configuration here
######################################

command[check_nrpe_daemon]=/bin/echo "NRPE OK" 

# disk checks
command[check_disk_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/root

# checking Apache logs for SIGTERM
command[check_apache_sigterm]=/usr/lib/nagios/plugins/check_cat.sh /var/log/apache2/error.log SIGTERM 0

add check_cat

In /usr/lib/nagios/plugins create check_cat.sh

#!/bin/bash

#
# checks in files if there are instances of a given string.
# $1 is the file
# $2 is the string
# $3 is the threshold, any more than $3 and it will be Critical

cnt=`cat $1|grep $2|wc -l`
recent=`cat $1|grep $2`
if [ $cnt -le $3 ] ; then
        echo OK - no errors or warnings
        exit 0
fi

echo -e "CRITICAL - String $2 appeared $cnt times\n$recent" 
exit 2

Make it executable

chmod 755 /usr/lib/nagios/plugins/check_cat.sh

Make total procs check ignore kernel processes

Add -k to the total_procs check in /etc/nagios/nrpe.cfg, and lower the threshold.

command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -k -w 130 -c 180

restart service

service nagios-nrpe-server restart

on monitoring server

test connection

On Nagios/Icinga server test that that worked:

/usr/lib/nagios/plugins/check_nrpe -H clientserveruri.com -c check_nrpe_daemon
NRPE OK

set up checks.

example service config file

###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     SSH
        check_command           check_ssh
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     HTTP
        check_command           check_http
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     Users
        check_command           check_nrpe_1arg!check_users
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     Load
        check_command           check_nrpe_1arg!check_load
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     Zombie Processes
        check_command           check_nrpe_1arg!check_zombie_procs
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     Total Processes
        check_command           check_nrpe_1arg!check_total_procs
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     Disk Space /root
        check_command           check_nrpe_1arg!check_disk_root
        }

define service{
        use                     generic-service         ; Inherit default values from a template
        host_name               clientserver
        service_description     Apache SIGTERM
        check_command           check_nrpe_1arg!check_apache_sigterm
        }

restart monitoring service

for icinga

/etc/init.d/icinga restart

sources:
http://xmodulo.com/2014/03/nagios-remote-plugin-executor-nrpe-linux.html
https://wiki.icinga.org/display/howtos/Setting+up+NRPE+with+Icinga

Updated by Jamila Khan over 8 years ago · 4 revisions

Also available in: PDF HTML TXT

Go to top