Page 1 of 1

Performance graphs debugging

Posted: Wed Oct 13, 2010 3:15 am
by lmilkovic
Hello everyone!

I recently migrated from Nagios Core to Nagios XI and I'm very pleased with the Nagios XI look and functionalities.
However, I have a small issue with performance graphs...

In Nagios Core with PNP4Nagios installed, when Service Overview (i.e. graphs) were requested, PNP debugging information was shown if a given template had errors. This was really helpful, because all errors were shown immediately and I was able to quickly debug and fix them. This behavior is shown on the image below:

Image

In Nagios XI there is no debug screen shown, although debug.php page is present in /usr/local/nagios/share/pnp/include (same script is present in Nagios Core bundled with PNP4Nagios). If custom template (in /usr/local/nagios/share/pnp/templates) with error is encountered, no debug info is shown and the graph won't be drawn.

Performance data is correctly collected - if custom template is deleted and default.php is used, graph is shown without problems.
I tried to compensate the lack of debugging info with increased log level (in npcd.cfg), but logs still lack information about errors encountered in a particular template.

Is there any way to enable the same PNP debugging in Nagios XI that is present in Nagios Core with PNP4Nagios as shown above?
If not, is there any other "efficient" way of testing custom templates? I heard about verify_pnp_config, but I don't think it is as "streamlined" as the method I described above.

Thanks in advance!

P.S.
My company is Nagios Authorized Reseller - do we have access to Nagios XI Customer Support forum?

Re: Performance graphs debugging

Posted: Wed Oct 13, 2010 1:01 pm
by mmestnik
Send an email to [email protected], they directly manage access to the support forums/lists/ect currently.

PNP should be able to be configured as it is with Nagios Core. I'd have to ask around about this particular feature. Let us know of any changes we should make. We may investigate adding this into our reports that we plan to add, the next time we add more reports.

Thank you.

Re: Performance graphs debugging

Posted: Fri Oct 15, 2010 9:21 am
by lmilkovic
I analyzed PHP files in /usr/local/nagiosxi/html/ directory and it seems you can access "old" PNP directly by using direct link specified in $cfg['component_info']['pnp']['direct_url'] element (i.e. /nagios/pnp). You can then search for the wanted device/graph and if errors in templates exist, debugger will show them.

I was, however, unable to find why "new" Nagios XI performance graph view doesn't show these errors as well. I tried to follow the execution path, but some of the files are obfuscated so I cannot see how rrdgraph is called and what is being returned.

While analyzing the files, I discovered one interesting "issue".
Recently, I was trying to draw graphs of every port on a switch. I made a custom template which looped over each datasource in XML file and made 16 graphs with IN/OUT traffic shown.
On Nagios Core everything worked perfectly - 16 graphs were shown.

When we migrated the configuration to Nagios XI, only 2 graphs were shown, without any warning or explanation whatsoever.
Today, I found out the root cause of this behavior.

File /usr/local/nagiosxi/html/includes/components/pnp/pnp.inc.php contains function pnp_read_service_sources_from_template_file() that is responsible for reading all data sources from XML file in perfdata dir.
On Nagios Core, custom templates (and all other templates) are used in a way that they are first included, their code is then executed and all variables (such as $def, $opt, $ds_name) are available for other parts of the "parser".
Nagios XI does not include template - it only parses the template just like the ordinary file, without executing code in the template. It's obvious that the code in template won't be executed, instead, $def array contents will be copied to the "parser".
include_once($template) directive actually exists, but it is commented out.

Is there any valid reason why include is not used?
I commented the "file parsing" code, and commented out the include_once directive and everything works fine, and my 16 graphs are finally shown on the screen.

Re: Performance graphs debugging

Posted: Mon Oct 18, 2010 12:42 pm
by mguthrie
I don't have an answer for your question at this time, but I passed this onto our lead developer. We appreciate your feedback on this!

Re: Performance graphs debugging

Posted: Tue Nov 09, 2010 7:40 pm
by aels
Hi,
Some feedback on this would be great.
I found same problem and following the advice above I now have multiple graphs (which is correct according to my custom template), instead of just one.
Cheers
Anton

Re: Performance graphs debugging

Posted: Wed Nov 10, 2010 4:19 pm
by mguthrie
I would file this as a feature request:
http://tracker.nagios.com/

This may be something we could do for future releases.