Page 1 of 1

Nagios XI 5.7 API Documentation Help

Posted: Thu Jun 25, 2020 3:23 pm
by HooverM
I am new to Nagios XI and my group is looking to create an external web site using the API for status of specific hosts/services for specific groups.

I was looking into the API documentation and found I can pull back all the necessary information I need...BUT...I have no real definition to decipher it. I was wondering if there was any thorough documentation for using the new REST API. I looked under HELP > API Docs and it gives me the URL and an example of the return, but it doesn't tell me what the items mean or the possible results for them.
for example:

Host Status --
"current_state":"0"

I've seen before with the old CGI-BIN JSON there was an enumerate format option that could be used to get Up, Down, etc. but I have tried using &formatoptions=enumerate and that does not seem to be a valid option.

Any help would be appreciated.

Re: Nagios XI 5.7 API Documentation Help

Posted: Fri Jun 26, 2020 11:11 am
by jbrunkow
The API within XI interacts with objects defined in the Nagios core. I believe you will find the definitions you are looking for in the Nagios core documentation.

Possible state types in Nagios include OK, WARNING, UP, DOWN, and UNKNOWN. Please see the documentation linked below for a more in depth explanation.
NAGIOS STATE TYPES

You may also be interested to look at the object definitions page in the core docs.
OBJECT DEFINITIONS

I hope that helps! Let me know if I can answer any more questions.

Re: Nagios XI 5.7 API Documentation Help

Posted: Fri Jun 26, 2020 11:45 am
by HooverM
Thank you, this did help a lot, it lead me down the right path. I ended up coming across this page
https://assets.nagios.com/downloads/nag ... #hoststate

And that set me on the right path of what I was looking for --
My For Example:
$HOSTSTATEID$ A number that corresponds to the current state of the host: 0=UP, 1=DOWN, 2=UNREACHABLE.

Thank you again! I do appreciate the information and if I run into any further items I will come back to here for help!

Re: Nagios XI 5.7 API Documentation Help

Posted: Fri Jun 26, 2020 1:26 pm
by lmiltchev
I am glad your question has been answered! I am closing this topic. If you have any further questions, please start a new thread.