Page 1 of 1

Query the Host or Service Problem ID using the API?

Posted: Mon Jul 21, 2025 9:23 am
by ykara84
We are using the Nagios XI Event Handlers to create ServiceNow incidents whenever a host goes down or a service (CPU, memory, disk space) become unhealthy. We are using the macros to include the host/service problem ID in the description of the incident.

We want to use this host/service problem ID to query NagiosXI to see if the problem has cleared so we can resolve the incident. Is it possible to query the Nagios XI Rest API using the host/service problem ID to check if the issue has cleared?

We have tried using the Get-NagiosXiAllServiceProblems and Get-NagiosXiAllHostProblems Powershell functions from the MrANagios module but they dont seem to return the Problem IDs for each problem corresponding to the ID from the macro, and cant seem to find a way of querying each problem ID. The API returns a servicestatus_ID which doesnt mathch the serviceproblemid

Any assistance is appreciated

Re: Query the Host or Service Problem ID using the API?

Posted: Fri Jul 25, 2025 5:59 am
by ykara84
Somewhat related to this. For existing alerts, how do I determine the HOSTEVENTID or SERVICEEVENTID (which are available as macros) for each using the API?

Re: Query the Host or Service Problem ID using the API?

Posted: Sun Jul 27, 2025 11:01 pm
by betterwound
ykara84 wrote: Mon Jul 21, 2025 9:23 am We are using the Nagios XI Event Handlers to create ServiceNow incidents whenever a host goes down or a service (CPU, memory, disk space) become unhealthy. We are using the macros to include the host/service problem ID in the description of the incident.

We want to use this host/service problem ID to query NagiosXI to see if the problem has cleared so we can resolve the incident. Is it possible to query the Nagios XI Rest API using the host/service problem ID to check if the issue has cleared?

We have tried using the Get-NagiosXiAllServiceProblems and Get-NagiosXiAllHostProblems Powershell functions from the MrANagios moduleTap Road but they dont seem to return the Problem IDs for each problem corresponding to the ID from the macro, and cant seem to find a way of querying each problem ID. The API returns a servicestatus_ID which doesnt mathch the serviceproblemid

Any assistance is appreciated
You should record the host_name and service_description into the ticket's custom fields in ServiceNow for later retrieval. You can create a script periodically (every 5 mins) to check the status and call the ServiceNow API to automatically close the ticket.

Re: Query the Host or Service Problem ID using the API?

Posted: Mon Jul 28, 2025 9:26 am
by ykara84
That is essentially what we've ended up doing or something very similar, but I thought there must be a cleaner solution using the Event ID or Problem ID provided by the macros to do a lookup, alas there does not seem to be.