Query the Host or Service Problem ID using the API?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
ykara84
Posts: 7
Joined: Wed Feb 21, 2024 4:20 am

Query the Host or Service Problem ID using the API?

Post 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
ykara84
Posts: 7
Joined: Wed Feb 21, 2024 4:20 am

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

Post 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?
betterwound
Posts: 12
Joined: Mon Jul 24, 2023 11:11 pm

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

Post 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.
ykara84
Posts: 7
Joined: Wed Feb 21, 2024 4:20 am

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

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