Page 1 of 1

Nagios XI API current_state not equal to 0

Posted: Fri Feb 28, 2020 2:14 am
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

Re: Nagios XI API current_state not equal to 0

Posted: Fri Feb 28, 2020 8:37 am
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

Re: Nagios XI API current_state not equal to 0

Posted: Sun Mar 01, 2020 1:11 am
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.

Re: Nagios XI API current_state not equal to 0

Posted: Mon Mar 02, 2020 8:05 am
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