Viewing Open Problems from the Command Line

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bvinisky
Posts: 34
Joined: Wed Jul 06, 2011 11:28 am

Viewing Open Problems from the Command Line

Post by bvinisky »

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
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

Post by scottwilkerson »

Using the backend API you can append filters to the URL, like adding the following to the getservicestatus call

Code: Select all

&current_state=2
would show all services with current_state of 2
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bvinisky
Posts: 34
Joined: Wed Jul 06, 2011 11:28 am

Re: Viewing Open Problems from the Command Line

Post by bvinisky »

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
Locked