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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sdotsen
Posts: 1
Joined: Thu Nov 29, 2012 1:14 pm

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

Post 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
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

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

Post 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?
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

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

Post 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.
Locked