Page 1 of 1

API for Querying the Data

Posted: Tue Aug 06, 2019 5:06 am
by amitgupta19
I am using the Nagios Core 4.4.3 on Cent OS 7.

I am planning to integrate the Nagios with Service Now using a Tool.
For the Integration i need the APIs to query the data.

I know that there is Backend API for the Nagios XI, can i use the same for the Nagios Core?

If No is there any other way to query the Nagios core data.

Re: API for Querying the Data

Posted: Tue Aug 06, 2019 6:58 am
by scottwilkerson
Nagios Core has a read-only API available at the following endpoint on your Core install

Code: Select all

/nagios/jsonquery.html

Re: API for Querying the Data

Posted: Tue Aug 06, 2019 8:15 am
by amitgupta19
Thanks Scott,

I will need to give the team a URL along with the credentials to query the data from the Nagios.

Can you suggest how can i do it?

Re: API for Querying the Data

Posted: Tue Aug 06, 2019 8:26 am
by scottwilkerson
If you go to

Code: Select all

http://YOUR_HOST/nagios/jsonquery.html
make selections

run the query, then it will display the url for the specific query you want to run.

As for credentials, this will be credentials for a user with access to the nagios interface.

Re: API for Querying the Data

Posted: Tue Aug 06, 2019 9:48 am
by amitgupta19
Thanks Scott

My requirement is to get the list of the services whose status is Critical along with their current Values.

When used the URL and selected the options as follows:
CGI: Status Jason CGI
Query: Servicelist
Show Details: true
Service Status: Critical

It is giving the following URL:
http://xxx.xxx.xxx.xxx/nagios/cgi-bin/s ... tails=true

Also in the result it is giving the status of all the services weather it is critical or not. From the URl also it is also clear that it is giving the result/status of all the services.

Due to this it is taking long time to complete.

Re: API for Querying the Data

Posted: Tue Aug 06, 2019 9:54 am
by scottwilkerson
You can add the following to the URL

Code: Select all

&servicestatus=critical