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
Secondary Alerting on Primary Global Notification Status
Re: Secondary Alerting on Primary Global Notification Status
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:
And you would run it like:
For example:
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
fiCode: Select all
./check_notifications.sh "<username>" "<password> "<nagios server>"Code: Select all
[root@localhost libexec]# ./check_notifications.sh "nagiosadmin" "welcome" "localhost"
OK - Notifications on Nagios server localhost are enabledFormer 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.
"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.
- 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
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.