Notifications not being sent.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
epx998
Posts: 31
Joined: Mon Nov 21, 2011 3:51 pm

Notifications not being sent.

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Notifications not being sent.

Post 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)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
epx998
Posts: 31
Joined: Mon Nov 21, 2011 3:51 pm

Re: Notifications not being sent.

Post by epx998 »

I had to tweak the alert settings some, it is working now.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Notifications not being sent.

Post by slansing »

Good to hear, do you recall which settings?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Notifications not being sent.

Post by abrist »

Great. Happy scripting.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked