Page 1 of 1

Nagios API URL are not constructed properly

Posted: Tue Sep 24, 2019 2:05 pm
by gzaloprgm
Hi.

We have detected that some URLs that fusion uses to poll XI servers are wrong
/nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:0?brevity=1
/nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:1000&brevity=1
/nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:2000&brevity=1

/nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:0?brevity=1
/nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:1000&brevity=1
/nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:2000&brevity=1

As it can be seen, what's marked in bold is probably wrong (it should be an ampersand instead of a question mark), so right now the brevity argument is ignored for the first 1000 host/servicestatus. The other requests (starting from the record 1000) are fine and don't have that bug.
Thanks, Gonzalo

Re: Nagios API URL are not constructed properly

Posted: Tue Sep 24, 2019 4:12 pm
by scottwilkerson
What version of Fusion are you running? I have not been able to reproduce this

Re: Nagios API URL are not constructed properly

Posted: Tue Sep 24, 2019 9:13 pm
by gzaloprgm
Hi. I'm using latest Nagios Fusion 4.1.7, running from the downloaded ova.

The easiest way to reproduce it is to just fuse a new XI server and check its access logs (check the full image, I've highlighted the issue with red):

Image

I know this bug is only minor and does not affect the data that's being shown in most views, but it is annoying and can lead to unusual bugs if you want to develop your own polling callbacks.

Thanks, Gonzalo

Re: Nagios API URL are not constructed properly

Posted: Wed Sep 25, 2019 11:10 am
by scottwilkerson
I understood what you were mentioning but when trying to replicate this I get all &brevity=1 in the logs

Code: Select all

"GET /nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:0&brevity=1 HTTP/1.1" 200 129669
"GET /nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:1000&brevity=1 HTTP/1.1" 200 67
"GET /nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:0&brevity=1 HTTP/1.1" 200 1387730
"GET /nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:1000&brevity=1 HTTP/1.1" 200 73
"GET /nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:0&brevity=1 HTTP/1.1" 200 129660
"GET /nagiosxi/api/v1/objects/hoststatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:1000&brevity=1 HTTP/1.1" 200 67
"GET /nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:0&brevity=1 HTTP/1.1" 200 1387767
"GET /nagiosxi/api/v1/objects/servicestatus?fusekey=...&outputtype=xml&user=nagiosadmin&records=1000:1000&brevity=1 HTTP/1.1" 200 73
Did you add a custom polling callback that could be causing this?

Re: Nagios API URL are not constructed properly

Posted: Fri Sep 27, 2019 10:16 am
by gzaloprgm
scottwilkerson wrote: Did you add a custom polling callback that could be causing this?
No, I'm using the nagiosfusion-4.1.7-64.ova as-is. I've also tried installing it manually using an Centos 7 appliance (from osboxes.org) and the same thing happens.
I will try to record a screen capture video, so that you can check and see if I'm doing anything wrong.
Thanks, Gonzalo

Re: Nagios API URL are not constructed properly

Posted: Fri Sep 27, 2019 12:50 pm
by scottwilkerson
My initial testing was on a CentOS 6 system where I couldn't re-create the issue, but since your last post I spun up the OVA and can replicate the issue.

This has been send to our development team to look at to be fixed in a future release.

Thanks for working with us on this, I suspect it is a difference in how php handles some functions between versions.