Page 1 of 1

Possible Bug in REST API

Posted: Wed Oct 11, 2017 9:48 am
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)
}
}

Re: Possible Bug in REST API

Posted: Wed Oct 11, 2017 11:19 am
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.

Re: Possible Bug in REST API

Posted: Wed Oct 11, 2017 11:59 am
by vmesquita
Hi npolovenko,

Apparently the restart did the trick. Thanks!

Re: Possible Bug in REST API

Posted: Wed Oct 11, 2017 1:45 pm
by npolovenko
@vmesquita, Glad this got resolved! If you have other questions please create a new thread.