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