Is there an easy way to view open problems (host and service) via the command line? I've reviewed this list http://old.nagios.org/developerinfo/ext ... ndlist.php but didn't see anything that would dump out any current host and service problems. My end goal is to pipe a list of host and service problems back into ACKNOWLEDGE_SVC_PROBLEM so a filtered number of alerts can be acked from the command line. My issue is getting the <service_description> (of which we have a ton) for any service that's in a hard state.
I'm using NagiosXI and also have the backend API installed, but that doesn't have a list of just the open problems, though there is a massive Current Service Status. I'm trying to avoid having to transform that XML, though it could be used if there's no alternative.
Thanks!
Bryant
Viewing Open Problems from the Command Line
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Viewing Open Problems from the Command Line
Using the backend API you can append filters to the URL, like adding the following to the getservicestatus call
would show all services with current_state of 2
Code: Select all
¤t_state=2Re: Viewing Open Problems from the Command Line
Thanks scottwilkerson! That's just what I needed. Posting current_state=2, state_type=1 and problem_acknowledged=0 to the NagiosXI backend API gave me the list I was after. I was then able to filter out the host_name and name (which is the service_description that the external command ACKNOWLEDGE_SVC_PROBLEM requires). This and the other required data was easily posted via NRDP so everything could be acknowledged via the command line. Sweet deal!
Bryant
Bryant