2009-10-27 13:04:16 +00:00
|
|
|
<?php
|
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
include("includes/graphs/common.inc.php");
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-30 19:15:58 +00:00
|
|
|
if($width > "500")
|
|
|
|
{
|
|
|
|
$descr_len=24;
|
|
|
|
} else {
|
|
|
|
$descr_len=12;
|
|
|
|
$descr_len += round(($width - 250) / 8);
|
|
|
|
}
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-30 19:15:58 +00:00
|
|
|
if ($nototal) { $descrlen += "2"; $unitlen += "2";}
|
|
|
|
|
|
|
|
if($width > "500")
|
|
|
|
{
|
2011-10-21 10:54:06 +00:00
|
|
|
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'";
|
2011-09-30 19:15:58 +00:00
|
|
|
if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; }
|
|
|
|
$rrd_options .= " COMMENT:'\l'";
|
|
|
|
} else {
|
2011-10-21 10:54:06 +00:00
|
|
|
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'";
|
2011-09-30 19:15:58 +00:00
|
|
|
|
|
|
|
}
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-30 19:15:58 +00:00
|
|
|
$i = 0;
|
|
|
|
$iter = 0;
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
foreach ($rrd_list as $rrd)
|
|
|
|
{
|
|
|
|
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
$colour=$config['graph_colours'][$colours][$iter];
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-21 11:59:59 +00:00
|
|
|
$ds = $rrd['ds'];
|
2011-03-17 10:57:51 +00:00
|
|
|
$filename = $rrd['filename'];
|
2011-09-30 19:15:58 +00:00
|
|
|
|
|
|
|
$descr = str_replace(":", "\:", substr(str_pad($rrd['descr'], $descr_len),0,$descr_len));
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-18 22:55:29 +00:00
|
|
|
$id = "ds".$i;
|
2011-03-11 12:01:13 +00:00
|
|
|
|
2011-09-21 11:59:59 +00:00
|
|
|
$rrd_options .= " DEF:".$id."=$filename:$ds:AVERAGE";
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-09-30 13:31:00 +00:00
|
|
|
if ($simple_rrd)
|
2011-03-17 10:57:51 +00:00
|
|
|
{
|
2011-09-30 13:09:14 +00:00
|
|
|
$rrd_options .= " CDEF:".$id."min=".$id." ";
|
|
|
|
$rrd_options .= " CDEF:".$id."max=".$id." ";
|
|
|
|
} else {
|
2011-09-21 11:59:59 +00:00
|
|
|
$rrd_options .= " DEF:".$id."min=$filename:$ds:MIN";
|
|
|
|
$rrd_options .= " DEF:".$id."max=$filename:$ds:MAX";
|
2011-09-18 22:55:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($rrd['invert'])
|
|
|
|
{
|
|
|
|
$rrd_options .= " CDEF:".$id."i=".$id.",-1,*";
|
2011-09-19 08:54:48 +00:00
|
|
|
$rrd_optionsb .= " LINE1.25:".$id."i#".$colour.":'$descr'";
|
2012-05-02 22:02:30 +00:00
|
|
|
if (!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."i#" . $rrd['areacolour']; }
|
2011-03-17 10:57:51 +00:00
|
|
|
} else {
|
2011-09-19 08:54:48 +00:00
|
|
|
$rrd_optionsb .= " LINE1.25:".$id."#".$colour.":'$descr'";
|
2012-05-02 22:02:30 +00:00
|
|
|
if (!empty($rrd['areacolour'])) { $rrd_optionsb .= " AREA:".$id."#" . $rrd['areacolour']; }
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
|
|
|
|
2011-09-30 13:09:14 +00:00
|
|
|
$rrd_optionsb .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id."min:MIN:%5.2lf%s";
|
|
|
|
$rrd_optionsb .= " GPRINT:".$id."max:MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:'%5.2lf%s\\n'";
|
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
$i++; $iter++;
|
2011-09-18 22:55:29 +00:00
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
}
|
|
|
|
|
2011-09-19 08:54:48 +00:00
|
|
|
$rrd_options .= $rrd_optionsb;
|
|
|
|
$rrd_options .= " HRULE:0#555555";
|
2011-09-18 22:55:29 +00:00
|
|
|
|
|
|
|
?>
|