Page 1 of 3

Graph Template problem

Posted: Sun Nov 20, 2011 9:02 pm
by Fred Kroeger
I've tried to create my own graph template however it appears that some variables are not being defined when it gets called.

I have a command "check_emc_clarrion" that is displaying graphs OK using the default template.
I download the default.php template , rename it to check_emc_clariion.php and upload it back to Nagios using the Admin Graph Templates page. No changes are made to the contents of the php file.
When I try to display the graphs created by the check_emc_clariion command, the graphs no longer display.
Noticed that we have many errors in the apache log about variables being undefined.

Code: Select all

[Thu Nov 17 10:43:40 2011] [error] [client 203.25.253.121] PHP Notice:  Undefined index:  in /usr/local/nagios/share/pnp/templates/check_emc_clariion.php on line 27, referer: http://172.30.0.105/nagiosxi/includes/components/xicore/status.php?show=servicedetail&host=DRDC_CX4_960_0858%20SPA&service=EMC%20CLARiiON%20-%20Array%20IOPS&dest=auto
If I delete the check_emc_clariion.php template , then the graphs are displayed once again

Re: Graph Template problem

Posted: Mon Nov 21, 2011 12:06 pm
by mguthrie
I just added a fix in our latest SVN code that might resolve this issue. Try installing this zip through the Admin->Manage Components page and see if it resolves the issue.

Re: Graph Template problem

Posted: Mon Nov 21, 2011 9:40 pm
by Fred Kroeger
Works correctly now - many thanks.
Fred

Re: Graph Template problem

Posted: Tue Nov 22, 2011 4:03 pm
by mguthrie
You bet!

Re: Graph Template problem

Posted: Mon Nov 28, 2011 7:54 pm
by Fred Kroeger
Almost OK.....
We can display a graph now, however it will only show the first DS for metrics that have multiple DS's.
Example:
If the deafult graph template is used (default.php) then multiple graphs will be dispalyed of there is more than one DS.
If we just copy that default.php and upload it with the name of one of our check commands, it will then only display the graph for the first DS - not the others.

regards.... Fred

Re: Graph Template problem

Posted: Tue Nov 29, 2011 10:30 am
by mguthrie
The behavior for custom templates is a bit different than it is for the default. If I remember correctly, if there is a custom template defined for a particular check, it's assumed that the template will handle whatever number of datasources that check returns. But if no template is defined, I think it just loops through the datasources and creates a graph with the default template. Does that make sense?

Re: Graph Template problem

Posted: Tue Mar 27, 2012 10:55 am
by adambot
I am having the same issue where i have a loop in my template where it creates multiple graphs, however, i can only get one of the datasources to show. is there anything i can do to get all of them to show properly?

thanks,
Adam

Re: Graph Template problem

Posted: Tue Mar 27, 2012 11:52 am
by mguthrie
What version of Xi are you running? We added a few fixes in 2011R2.2 to increase template compatibility.

If you're already on 2.2, go and and post the template and we'll see what we can do about improving compatibility.

Re: Graph Template problem

Posted: Tue Mar 27, 2012 1:36 pm
by adambot
We are currently at 2.2 attached is the template. do you need sample perfdata also?

Re: Graph Template problem

Posted: Tue Mar 27, 2012 4:59 pm
by mguthrie
Actually the associated XML file for that performance data is the other key thing I'd need.

/usr/local/nagios/share/perfdata/<host>/<service>.xml