Notifications not being sent.
Posted: Wed Jun 19, 2013 3:38 pm
I wrote a new script to send out alerts when someone is logged into a system. I copied a working test and just adjusted my check_nrpe argument, however the notifications are not going out. Could it be the script? Below is the script - looks ok, Nagios shows it has a warning but wont send notifications. Also my mobile Nagios app also isnt picking up the warnings.
Code: Select all
#!/bin/bash
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
activeCount=`w -h | wc -l`
if [ "$activeCount" -eq "0" ] ; then
echo "Status OK: ($activeCount) active users."
exit $STATE_OK
fi
if [ "$activeCount" -gt "0" ] ; then
echo -n "Status Warning: ($activeCount) active users: "
for who in `w -h | awk '{print $1 ":" $5}'`
do
echo -n "($who)"
done
exit $STATE_WARNING
fi