attached is the xml.
thanks!
Adam
graph Template problem
-
- Posts: 10
- Joined: Wed Nov 23, 2011 11:11 am
Re: graph Template problem
You do not have the required permissions to view the files attached to this post.
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: graph Template problem
I'm wondering if this is just a counter issue. For some reason that I never understood, all of the PNP template arrays have to start at 1 instead of 0, so I think when you use the foreach loop, it's starting by assigning things to $def[0], which is just an empty placeholder. I would experiment with either doing
There is a graph logger in XI for graphs that failed to draw. (If it's not there, touch it, and set perms as 777).
/usr/local/nagios/var/graphapi.log
Access a particular graph that's now showing correctly, and run:
You can also try tailing the apache log to see if there are any PHP errors coming from the template.
on line 5, OR starting the loop at an index of 1 instead of 0.$count++;
Code: Select all
for($i=1; $i<count($DS); $i++) {
/usr/local/nagios/var/graphapi.log
Access a particular graph that's now showing correctly, and run:
Code: Select all
tail -f /usr/local/nagios/var/graphapi.log
Code: Select all
tail -f /var/log/httpd/error_log
-
- Posts: 10
- Joined: Wed Nov 23, 2011 11:11 am
Re: graph Template problem
I tried both count++ and the for string you gave me, and like always the graphs are being generated, but not showing in the frontend.
I created the file with 777 and started looking at the graphs, however, nothing was ever written to that file
the only errors in the error_log were as follows:
PHP Notice: Undefined variable: sa in /usr/local/nagiosxi/html/config/configobject.php on line 933, referer: https://nagiosxi.domain.example.com/nag ... xample.com
[Thu Mar 29 13:42:09 2012] [error] [client 134.48.25.59] PHP Notice: unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Argument is not a string in /usr/local/nagiosxi/html/includes/components/xicore/status-utils.inc.php on line 302, referer: https://vs-nagiosxi/nagiosxi/includes/c ... e=overview
Like i alluded to before, i am able to get to the missing graphs, however i have use the following link and change the source= value:
https://nagiosxi.domain.example.com/nag ... 1333126779
I created the file with 777 and started looking at the graphs, however, nothing was ever written to that file
the only errors in the error_log were as follows:
PHP Notice: Undefined variable: sa in /usr/local/nagiosxi/html/config/configobject.php on line 933, referer: https://nagiosxi.domain.example.com/nag ... xample.com
[Thu Mar 29 13:42:09 2012] [error] [client 134.48.25.59] PHP Notice: unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Argument is not a string in /usr/local/nagiosxi/html/includes/components/xicore/status-utils.inc.php on line 302, referer: https://vs-nagiosxi/nagiosxi/includes/c ... e=overview
Like i alluded to before, i am able to get to the missing graphs, however i have use the following link and change the source= value:
https://nagiosxi.domain.example.com/nag ... 1333126779
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: graph Template problem
Ok, so before I go and set up a passive test with this template, what happens if you make a copy of this template and name it:
check_by_ssh-cpu.php
Based on the XML file for this service, it's looking for that file as a template. Nagios XI associates graph templates with the command definition that the service uses. So for example, a service that uses the defined command: check_local_disk will look for the template check_local_disk.php for a template.
check_by_ssh-cpu.php
Based on the XML file for this service, it's looking for that file as a template. Nagios XI associates graph templates with the command definition that the service uses. So for example, a service that uses the defined command: check_local_disk will look for the template check_local_disk.php for a template.
-
- Posts: 10
- Joined: Wed Nov 23, 2011 11:11 am
Re: graph Template problem
mguthrie wrote:Ok, so before I go and set up a passive test with this template, what happens if you make a copy of this template and name it:
check_by_ssh-cpu.php
that is what the template is currently named:
Code: Select all
$ ls -l /usr/local/nagios/share/pnp/templates/check_by_ssh-cpu.php
-rw-r--r-- 1 root nagios 1222 Mar 30 12:27 /usr/local/nagios/share/pnp/templates/check_by_ssh-cpu.php
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: graph Template problem
Ok, so after way more digging than I was expecting, I discovered a bug/limitation in our current code. It appears as though our code doesn't currently support dynamic counts of datasources in the PNP templating. So what appears to be keeping the additional graphs from being displayed is noted below:
This works, because XI can identify an integer for the datasource value.
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
This currently doesn't work because of how XI currently parses for datasource.
I did some snooping on how we could add this support in XI, but at the moment the way it's set up it's going to be a royal pain to add support for it, since PNP templates aren't really templates, they're just code that people can setup however they want. You could modify the template to work differently, the key string that XI is looking for is:
$def[1] and $def[2] and so on.
This works, because XI can identify an integer for the datasource value.
$def[1] = "DEF:var1=$rrdfile:$DS[1]:AVERAGE " ;
This currently doesn't work because of how XI currently parses for datasource.
Code: Select all
$def[$count] = "DEF:var1=$rrdfile:$DS[$sys]:AVERAGE " ;
$def[1] and $def[2] and so on.
-
- Posts: 10
- Joined: Wed Nov 23, 2011 11:11 am
Re: graph Template problem
I appreciate all your work on this!! do you know if it will be possible to put this in as a bug so that it gets fixed in a later release? (also, what would happen if i defined too many datasources initially EX: use the same template for a 2 and a 24 cpu server and have 24 ds's defined?)mguthrie wrote:Ok, so after way more digging than I was expecting, I discovered a bug/limitation in our current code. It appears as though our code doesn't currently support dynamic counts of datasources in the PNP templating. So what appears to be keeping the additional graphs from being displayed is noted below:
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: graph Template problem
Yeah, go ahead and file this on our tracker: tracker.nagios.com so that way it doesn't fall off our radardo you know if it will be possible to put this in as a bug so that it gets fixed in a later release?

I think what would happen at the moment is that for the 2CPU machine you'd get 2 good graphs and a bunch of blank ones. Although it'd be a little bit of a pain, you could create a template for a 2CPU, 4CPU, 8CPU and so on. Not very elegant, but it would work in the meantime.
I have a feeling the fix for this would ultimately be a small change to the code once we figured out what the solution is, but in the meantime I might have to let this idea marinate for a little while until we can come up with something that's not a drastic overhaul of the code ; )
-
- Posts: 10
- Joined: Wed Nov 23, 2011 11:11 am
-
- Posts: 4
- Joined: Tue Nov 27, 2012 1:35 pm
Re: graph Template problem
Has there been any updates to this bug? I don't see any in the tracker.
Even if someone could point me to the file in which the DS logic is run, I could probably figure this out myself.
I have a template I've created with about 12 different dynamically created DS's. I've confirmed that if I use this template as the "default.php" template, all graphs are displayed correctly. But if I run it as intended (i.e. leave default.php alone and run this template specifically for the check it's meant for) I only get 2...
I'm sure it's a relatively easy fix... I know the suggestion was to specify $def[1] etc... manually, but because these are generated dynamically, the number of counts will vary from host to host.
Cheers,
Ben
Even if someone could point me to the file in which the DS logic is run, I could probably figure this out myself.
I have a template I've created with about 12 different dynamically created DS's. I've confirmed that if I use this template as the "default.php" template, all graphs are displayed correctly. But if I run it as intended (i.e. leave default.php alone and run this template specifically for the check it's meant for) I only get 2...
I'm sure it's a relatively easy fix... I know the suggestion was to specify $def[1] etc... manually, but because these are generated dynamically, the number of counts will vary from host to host.
Cheers,
Ben