Nagios XI API current_state not equal to 0

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lucasari
Posts: 15
Joined: Tue Aug 13, 2019 4:26 am

Nagios XI API current_state not equal to 0

Post by lucasari »

Hi,

I found that it is possible to filter ther services and hosts in the API call hoststatus and servicestatus by current_state = <<state number>>
is it possible to filter by a negation? I would need to retrieve all services or hosts where the status is different from OK.

if that is not possible where are all the status codes documented for reference?

regards
Luca
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI API current_state not equal to 0

Post by scottwilkerson »

There are a few special operands, for this you can use

Code: Select all

&current_state=ne:0
or

Code: Select all

&current_state=in:1,2,3
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
lucasari
Posts: 15
Joined: Tue Aug 13, 2019 4:26 am

Re: Nagios XI API current_state not equal to 0

Post by lucasari »

that was very helpful!
is there a document with all these special operans for the API? I have been looking for it without luck.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI API current_state not equal to 0

Post by scottwilkerson »

I don't think we have a documented list, but I grabbed these to give a quick explanation of each:

ne: - not equal
lt: - less than
lte: - less than or equal
gt: - greater than
gte: - greater than or equal
lks: - Beginning string match
nlks: - Negative beginning string match
lke: - Ending string match
nlke: - Negative ending string match
lk: - Mid string match
nlk: - Negative mid string match
in: - In match (matches a list of comma separated results
nin: - Negative "in" match
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked