Page 1 of 1

Notifications not being sent.

Posted: Wed Jun 19, 2013 3:38 pm
by epx998
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

Re: Notifications not being sent.

Posted: Wed Jun 19, 2013 4:06 pm
by abrist
If ngaios is displaying the warning, then the issue is most likely not with your script, but with your nagios object configurations. Could you post the command definition, service definition, and host definition? (in code wraps)

Re: Notifications not being sent.

Posted: Wed Jun 19, 2013 6:43 pm
by epx998
I had to tweak the alert settings some, it is working now.

Re: Notifications not being sent.

Posted: Thu Jun 20, 2013 9:26 am
by slansing
Good to hear, do you recall which settings?

Re: Notifications not being sent.

Posted: Thu Jun 20, 2013 9:28 am
by abrist
Great. Happy scripting.