Page 1 of 2

response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 2:23 pm
by evisus
Regards!

I'm getting information from Nagios Core through json queries. Everything worked fine but I have noticed that as the number of host and services monitored by Nagios Core increases, the response times of a json query, for example "http://172.1.1.4/nagios/cgi-bin/objectjson .cgi?query= hostlist ", they are getting slower and slower.

I'm not sure if it's Core's expected behavior, will there be anything I can do to improve performance?

Thanks

Re: response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 3:15 pm
by npolovenko
Hello, @evisus. I'd start with increasing the memory_limit in the /etc/php.ini file. I recommend to double the amount of memory you have in the config and then restart the apache with:
service httpd restart

Re: response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 3:41 pm
by evisus
Thanks for your answer.

I have tripled the size but the response times do not vary.

Re: response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 4:15 pm
by mcapra
I'm wondering what the status of the report overhauls for Nagios Core 5 are? I vaguely recall such an item on the roadmap and it's been mentioned for Core 5 before:
https://github.com/NagiosEnterprises/na ... issues/143
https://github.com/NagiosEnterprises/na ... issues/280

Those CGIs could use some improvements and there's not much to be done at the configuration level currently.

Re: response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 4:20 pm
by npolovenko
@evisus , Looks like memory wasn't the issue here. How many host and service checks are you monitoring with this Core server? What is the actual response time for JSON queries? Nagios is using the objects.cache file to pull the objects definitions so disk IO would play a big role in how fast Nagios will gather the information. Implementing a ramdisk would be my next recommendation. This should increase the speed it takes for nagios to read/write from the objects.cache file since it will be moved to the ram disk.

Re: response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 4:29 pm
by evisus
I think I'll have to wait for Nagios Core 5.

Re: response time in Nagios Core JsonQuery

Posted: Thu Dec 27, 2018 5:11 pm
by npolovenko
Didn't see mcapra's response. @evisus, That works.

Re: response time in Nagios Core JsonQuery

Posted: Fri Jan 04, 2019 7:35 am
by evisus
Hello @npolovenko.

I have reviewed the recommendation indicated by @ mcapra's and I have made the changes in the file "status.c" to then recompile Nagios Core.

However, the response times are the same.

I'm not sure if I understood correctly what is explained in the forum.

Thanks for your support

Re: response time in Nagios Core JsonQuery

Posted: Fri Jan 04, 2019 12:31 pm
by mcapra
My intention in posting those GitHub issues was to indicate that there are known inefficiencies within those CGIs. @jfrickson indicated (in #271) that eliminating portions of the report can provide some performance gains.

Throwing hardware at the problem (as suggested by @npolovenko via a ramdisk) is one potential option.

The ultimate solution is better cross-referencing of objects within the Nagios Core runtime, rather than iterating over large lists to aggregate the information provided by the reporting CGIs. That's a bigger lift that simple changes to the status CGIs, though. Which I imagine is why this particular problem was put in the Nagios Core 5 milestone rather than tackled in a minor release.

I am almost positive a custom, faster reporting CGI could be written to be more performant for your specific use case (though I do not yet know what that use case is). That's generally not something this community can assist with, though Nagios Enterprises has offered custom development services in the past (for a price).

You could also look at implementing something like MK Livestatus instead of relying on the JSON CGIs for whatever your use case happens to be. I'm not totally confident it will be faster than the JSON CGIs (really depends on your use case), though it is at least worth exploring.

Re: response time in Nagios Core JsonQuery

Posted: Fri Jan 04, 2019 12:46 pm
by evisus
Thank you very much for the help and recommendations.

I'll see what results I have with RamDisk and I hope Nagios Core 5 will be released soon.

Greetings and an excellent 2019!