2009-10-27 13:04:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/// Draw generic bits graph
|
2010-06-20 17:21:35 +00:00
|
|
|
/// args: rra_in, rra_out, rrd_filename, bg, legend, from, to, width, height, inverse, percentile
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2010-07-24 19:14:41 +00:00
|
|
|
include("includes/graphs/common.inc.php");
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2010-07-31 19:12:40 +00:00
|
|
|
$unit_text = str_pad(truncate($unit_text,18,''),18);
|
|
|
|
$line_text = str_pad(truncate($line_text,12,''),12);
|
2010-06-20 17:21:35 +00:00
|
|
|
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " DEF:".$rra."=".$rrd_filename.":".$rra.":AVERAGE";
|
|
|
|
$rrd_options .= " DEF:".$rra."_max=".$rrd_filename.":".$rra.":MAX";
|
2009-10-27 13:04:16 +00:00
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
if ($print_total)
|
|
|
|
{
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " VDEF:".$rra."_total=rra,TOTAL";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
if ($percentile)
|
|
|
|
{
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " VDEF:".$rra."_percentile=".$rra.",".$percentile.",PERCENT";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
if ($graph_max)
|
|
|
|
{
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " AREA:".$rra."_max#".$colour_area_max.":";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " AREA:".$rra."#".$colour_area.":";
|
|
|
|
$rrd_options .= " COMMENT:'".$unit_text."Now Ave Max";
|
2011-03-17 10:57:51 +00:00
|
|
|
|
|
|
|
if ($percentile)
|
|
|
|
{
|
2009-11-20 00:36:42 +00:00
|
|
|
$rrd_options .= " ".$percentile."th %";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
2011-03-17 10:57:51 +00:00
|
|
|
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= "\\n'";
|
2010-07-31 19:12:40 +00:00
|
|
|
$rrd_options .= " LINE1.25:".$rra."#".$colour_line.":'".$line_text."'";
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " GPRINT:".$rra.":LAST:%6.2lf%s";
|
|
|
|
$rrd_options .= " GPRINT:".$rra.":AVERAGE:%6.2lf%s";
|
|
|
|
$rrd_options .= " GPRINT:".$rra."_max:MAX:%6.2lf%s";
|
2011-03-17 10:57:51 +00:00
|
|
|
|
|
|
|
if ($percentile)
|
|
|
|
{
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " GPRINT:".$rra."_percentile:%6.2lf%s";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
2011-03-17 10:57:51 +00:00
|
|
|
|
2009-10-27 13:04:16 +00:00
|
|
|
$rrd_options .= "\\\\n";
|
|
|
|
$rrd_options .= " COMMENT:\\\\n";
|
2011-03-17 10:57:51 +00:00
|
|
|
|
|
|
|
if ($print_total)
|
|
|
|
{
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " GPRINT:".$rra."_tot:Total\ %6.2lf%s\)\\\\l";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
2011-03-17 10:57:51 +00:00
|
|
|
|
|
|
|
if ($percentile)
|
|
|
|
{
|
2009-10-28 23:34:13 +00:00
|
|
|
$rrd_options .= " LINE1:".$rra."_percentile#aa0000";
|
2009-10-27 13:04:16 +00:00
|
|
|
}
|
|
|
|
|
2011-03-17 10:57:51 +00:00
|
|
|
?>
|