Secondary Alerting on Primary Global Notification Status

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
uidaho
Posts: 89
Joined: Tue Feb 12, 2013 11:58 am

Secondary Alerting on Primary Global Notification Status

Post by uidaho »

I am researching methods to alert ourselves from our secondary Nagios XI server that our primary server's global notifications have been disabled for more than X amount of time. Any input, ideas, examples of what others have done would be greatly appreciated!

thank you,

Clint
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Secondary Alerting on Primary Global Notification Status

Post by abrist »

Well, you could write a small script to call the json api and check the "enable_notifications" key. You may want to set a few retries on the check so that it only alerts when they have been disabled longer than the number of retries * the retry interval. I whipped up a quick script to do this:
check_notifications.sh:

Code: Select all

#/bin/bash
USERNAME="$1"
PASSWORD="$2"
SERVER="$3"

NOTIFY=$(curl -s http://$USERNAME:$PASSWORD@$SERVER/nagios/cgi-bin/statusjson.cgi?query=programstatus | grep "enable_notifications" | sed 's/.*: //' | sed s'/,//')

if [ "$NOTIFY" == "false" ]; then
        echo "CRITICAL - Notifications on Nagios server $SERVER are disabled"
        exit 2
elif [ "$NOTIFY" == "true" ]; then
        echo "OK - Notifications on Nagios server $SERVER are enabled"
        exit 0
else
        echo "UNKNOWN - Notification state on server $SERVER could not be checked."
        exit 3
fi
And you would run it like:

Code: Select all

./check_notifications.sh "<username>" "<password> "<nagios server>"
For example:

Code: Select all

[root@localhost libexec]# ./check_notifications.sh "nagiosadmin" "welcome" "localhost"
OK - Notifications on Nagios server localhost are enabled
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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Secondary Alerting on Primary Global Notification Status

Post by Box293 »

I also believe the "Nagios XI Server" monitoring wizard has some similar functionality. Secondary can watch Primary and vice versa.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked