graph template line color
Posted: Mon May 26, 2014 10:34 am
Hey All,
I've created a custom disk check that analizes % free on all disks and outputs the data. Check works great. I've also created a custom graph that shows all disks in one graph. I'm using a loop to get all the drives added to one graph.
My questions is how can I get the color of the line to change in each loop iteration. I've tried adding an if and case statement into the loop but as soon as I do that my graph dies.
Any ideas?
My Current Graph Code is:
I've created a custom disk check that analizes % free on all disks and outputs the data. Check works great. I've also created a custom graph that shows all disks in one graph. I'm using a loop to get all the drives added to one graph.
My questions is how can I get the color of the line to change in each loop iteration. I've tried adding an if and case statement into the loop but as soon as I do that my graph dies.
Any ideas?
My Current Graph Code is:
Code: Select all
<?php
$arrayCount=count($DS);
$opt[1] = "--vertical-label \"% Used\" -l0 --title \"Disk Space Usage for $hostname / $servicedesc\" ";
for($i=1; $i<=$arrayCount; $i++) {
$def[1] .= "DEF:$NAME[$i]=$rrdfile:$DS[$i]:AVERAGE " ;
$def[1] .= "LINE1:$NAME[$i]#0000FF:\"\"$NAME[$i] " ;
$def[1] .= "GPRINT:$NAME[$i]:LAST:\"%3.2lf $unit[i] CUR \" ";
$def[1] .= "GPRINT:$NAME[$i]:MAX:\"%3.2lf $unit[i] MAX \" ";
$def[1] .= "GPRINT:$NAME[$i]" . ':AVERAGE:"%3.2lf $unit[i] AVG \j" ';
}
?>