graph Template problem

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Fred Kroeger
Posts: 588
Joined: Wed Oct 19, 2011 11:36 pm
Location: Perth, Western Australia

graph Template problem

Post 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
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: graph Template problem

Post 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.
You do not have the required permissions to view the files attached to this post.
Fred Kroeger
Posts: 588
Joined: Wed Oct 19, 2011 11:36 pm
Location: Perth, Western Australia

Re: graph Template problem

Post by Fred Kroeger »

Works correctly now - many thanks.
Fred
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: graph Template problem

Post by mguthrie »

You bet!
Fred Kroeger
Posts: 588
Joined: Wed Oct 19, 2011 11:36 pm
Location: Perth, Western Australia

Re: graph Template problem

Post 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
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: graph Template problem

Post 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?
adambot
Posts: 10
Joined: Wed Nov 23, 2011 11:11 am

Re: graph Template problem

Post 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
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: graph Template problem

Post 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.
adambot
Posts: 10
Joined: Wed Nov 23, 2011 11:11 am

Re: graph Template problem

Post by adambot »

We are currently at 2.2 attached is the template. do you need sample perfdata also?
You do not have the required permissions to view the files attached to this post.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: graph Template problem

Post 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