Nagios Nrpe


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/ 190 200

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

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

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