Possible Bug in REST API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vmesquita
Posts: 315
Joined: Fri Aug 10, 2012 12:52 pm

Possible Bug in REST API

Post by vmesquita »

I think I may have found a bug in the REST API of Nagios XI.
The API return zero (0) instances of some objects, although there a lot of them.
For others objects, the API returns a wrong number of instances.
In particular, I observed these problems with the "host" and "service" objects.
The "Home Dashboard" of our Nagios server shows that there are 249 hosts and 4050 services, but using "curl" command to retrieve the list of these objects shows the outputs below (I masked the Nagios server and API key):

"host" object: 198 objects listed, but there are 249
=============================================
$ curl -s -XGET "http://nagios-srv/nagiosxi/api/v1/objec ... X&pretty=1"
{
"hostlist": {
"recordcount": "198", (249 would be the correct count)
"host": [
{
(output truncated)

"service" object: 0 objects listed, but there are 4050
===============================================
$ curl -s -XGET "http://nagios-srv/nagiosxi/api/v1/objec ... X&pretty=1"
{
"servicelist": {
"recordcount": "0" (4050 would be the correct count)
}
}
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Possible Bug in REST API

Post by npolovenko »

Hi, @vmesquita. We've tried to replicate the issue on one of our XI server that monitors over a hundred services, and we've got the correct record counts. I'd recommend to make sure that you don't have any duplicate nagios services running in the background:

Code: Select all

service nagios stop
killall -9 nagios
service nagios start
Also, make sure that you're using the API key that belongs to the admin user.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vmesquita
Posts: 315
Joined: Fri Aug 10, 2012 12:52 pm

Re: Possible Bug in REST API

Post by vmesquita »

Hi npolovenko,

Apparently the restart did the trick. Thanks!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Possible Bug in REST API

Post by npolovenko »

@vmesquita, Glad this got resolved! If you have other questions please create a new thread.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked