Page 1 of 1

How to get the notification status of a host's service?

Posted: Thu Nov 29, 2012 1:16 pm
by sdotsen
I know how to enable/disable notification alerts for a particular service. Now, how do I get the status to make sure it's been disabled or enabled?

I have the following which seems to work but wasn't sure if there was a "simpler" way.

Code: Select all

curl -s "http://mydomain.com/nagios/cgi-bin/extinfo.cgi?type=2&host=myserver&service=SSH" -u "nagios:nagios" | grep Notifications | egrep -oh "DISABLED|ENABLED" | tail -n1

Re: How to get the notification status of a host's service?

Posted: Thu Nov 29, 2012 5:44 pm
by jsmurphy
Well, there's a simpler way to display all of the disabled services http://roshamboot.org/main/?p=74 (see the serviceprops section)... but I don't know if that's what you are actually after. It's a rather unique scenario... I don't think there's too many people who are concerned with checking if a service is set to disabled... because it's (normally) a manual process.

Out of mere curiousity more than anything, why do you need to do this?

Re: How to get the notification status of a host's service?

Posted: Thu Nov 29, 2012 5:46 pm
by agriffin
If you're on the same machine as your Nagios server, you could grep the status.dat file instead of the web interface. Also, if you're using ndoutils you could pull that information from the database.