response time in Nagios Core JsonQuery

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
evisus
Posts: 82
Joined: Tue Apr 26, 2016 1:19 pm

response time in Nagios Core JsonQuery

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: response time in Nagios Core JsonQuery

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
evisus
Posts: 82
Joined: Tue Apr 26, 2016 1:19 pm

Re: response time in Nagios Core JsonQuery

Post by evisus »

Thanks for your answer.

I have tripled the size but the response times do not vary.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: response time in Nagios Core JsonQuery

Post 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.
Former Nagios employee
https://www.mcapra.com/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: response time in Nagios Core JsonQuery

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
evisus
Posts: 82
Joined: Tue Apr 26, 2016 1:19 pm

Re: response time in Nagios Core JsonQuery

Post by evisus »

I think I'll have to wait for Nagios Core 5.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: response time in Nagios Core JsonQuery

Post by npolovenko »

Didn't see mcapra's response. @evisus, That works.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
evisus
Posts: 82
Joined: Tue Apr 26, 2016 1:19 pm

Re: response time in Nagios Core JsonQuery

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: response time in Nagios Core JsonQuery

Post 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.
Former Nagios employee
https://www.mcapra.com/
evisus
Posts: 82
Joined: Tue Apr 26, 2016 1:19 pm

Re: response time in Nagios Core JsonQuery

Post 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!
Locked