Nagios Nrpe

nagios

How can we test an nrpe plugin from the command line?

./check_nrpe -H localhost -c check_current_incoming_smtp_count 190 200

For the above example, I have defined the check_current_incoming_smtp_count command inside the nrpe.cfg file:

command[check_current_incoming_smtp_count]=/usr/local/nagios/libexec/check_current_incoming_smtp_count.sh 190 200

and the content of my /usr/local/nagios/libexec/check_current_incoming_smtp_count.sh file:

#!/bin/sh
cnt=$(netstat -ant | awk '$4 ~ /:25$/ {print $4}' | wc -l)
warning=$1
critical=$2;
echo $cnt;
if [ "$cnt" -ge "$critical" ]; then
        echo "CRITICAL";
        exit 2;
elif [ "$cnt" -ge "$warning" ]; then
        echo "WARNING";
        exit 1;
else
        echo "OK";
        exit 0;
fi

How can we tell NRPE to reload its configuration file?

Assuming that we installed nrpe from a distribution, we probably should be able to reload the configuration file simply by restarting NRPE with:

service nrpe restart
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License