Nagios monitoring the stunnel

To monitor your working lggr server you might want to check for the concurrent connected clients. Just add a shell script check_lggr.sh to your /usr/local/bin:

#!/bin/bash
count=$( /bin/netstat -a|/bin/grep 5140|/usr/bin/wc -l )
output=”Connected clients: $count”
if [ $count -gt 7 ]
then
echo “OK – $output”
exit 0
elif [ $count -gt 1 ]
then
echo “WARNING – $output”
exit 1
else
echo “CRITICAL – $output”
exit 3
fi

and add that script to your local nrpe_local.cfg file in /etc/nagios:

command[check_lggr]=/usr/local/bin/check_lggr.sh

And finally add that service to your nagios server in /etc/nagios3/conf.d/services.cfg like:

define service {
host_name                       logserver
service_description             Lggr
check_command                   check_nrpe_1arg!check_lggr
use                             generic-service
notification_interval           0
}

It should write some lines like:

OK – Connected clients: 9


Posted

in

by