I've written my own perl script to return status from a server of mine. It is running just fine (ie. performance data: val1=1; val2=5; val3=10).
Using templates.dist/default.php this gives me 3 graphs (as I would expect).
Now this problem I have is, that I wish to make one more graph that has all 3 values in it.
I've been fiddling around with a template file but the results I'm getting seems very random and confusing.
<?php
for($i=1; $i < count($DS); $i++) {
$opt[$i] = '--title "My Graph '.$i.'"';
$def[$i] = 'DEF:var1='.$rrdfile.':'.$DS[$i].':AVERAGE LINE1:var1#000000';
}
$opt[4] = '--title "My Graph 4"';
$def[4] =
'DEF:var1='.$rddfile.':'.$DS[1].':AVERAGE '.
'DEF:var2='.$rddfile.':'.$DS[2].':AVERAGE '.
'DEF:var3='.$rddfile.':'.$DS[3].':AVERAGE '.
'LINE1:var1#FF0000:"Var 1" '.
'LINE1:var2#FF0000:"Var 2" '.
'LINE1:var3#FF0000:"Var 3"';
?>
With the fourth graph commented out, this usually just draw the first two (not three) graphs (third graph just isen't there). I say usually, because while making this post I checked it again and this time it inisisted on doing 5 graphs where the first 3 was as expected and the last two had a broken picture icon.
When I add the 4th graph it draws 3 graphs. If I add a $def[5] = "hmmm";
then the 4th graph displays, but with a broken picture icon.
I've changed titles to make sure it really is this file and not something cached, but these change like I would expect them them.
Can anyone please shed some light on what is going on here?
Using only the fourth combined graph as $def[1]
works.
Trying to debug why it won't display as the fourth graph has led me to nagiosxi/html/includes/components/perfdata/graphApi.php
. It looks like it tries to find a fourth datasource from the perfdata xml file located next to the rrd file. This, ofcause, only has 3 datasets as I'm only working with 3 datasets. I need all four graphs.
How do I add more graphs for a given service than the amount of datasets?