improve generic_multi_simplex_seperated

git-svn-id: http://www.observium.org/svn/observer/trunk@2698 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-10-25 09:47:45 +00:00
parent 569e5186b6
commit ececd2f8f6
3 changed files with 28 additions and 10 deletions

View File

@@ -11,7 +11,6 @@ if($width > "500")
}
if ($nototal) { $descrlen += "2"; $unitlen += "2";}
$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen);
if($width > "500")
{

View File

@@ -2,14 +2,30 @@
include("includes/graphs/common.inc.php");
$descrlen = "12";
$unitlen = "10";
if($width > "500")
{
$descr_len=24;
} else {
$descr_len=12;
$descr_len += round(($width - 250) / 8);
}
if ($nototal) { $descrlen += "2"; $unitlen += "2";}
$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen);
$rrd_options .= " COMMENT:'$unit_text Cur Max '";
if (!$nototal) { $rrd_options .= " COMMENT:' Total '"; }
$rrd_options .= " COMMENT:'\\n'";
if($width > "500")
{
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'";
if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; }
$rrd_options .= " COMMENT:'\l'";
} else {
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'";
}
$unitlen = "10";
if ($nototal) { $descrlen += "2"; $unitlen += "2";}
$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen);
$colour_iter=0;
foreach ($rrd_list as $i => $rrd)
@@ -23,6 +39,8 @@ foreach ($rrd_list as $i => $rrd)
$colour_iter++;
}
$descr = str_replace(":", "\:", substr(str_pad($rrd['descr'], $descr_len),0,$descr_len));
$rrd_options .= " DEF:".$rrd['ds'].$i."=".$rrd['filename'].":".$rrd['ds'].":AVERAGE ";
if ($simple_rrd)
@@ -67,9 +85,10 @@ foreach ($rrd_list as $i => $rrd)
$t_defname = $g_defname;
}
$rrd_options .= " AREA:".$g_defname.$i."#".$colour.":'".substr(str_pad($rrd['descr'], $descrlen),0,$descrlen)."':$stack";
$rrd_options .= " GPRINT:".$t_defname.$i.":LAST:%6.2lf%s".str_replace("%", "%%", $units)."";
$rrd_options .= " GPRINT:".$t_defname.$i."max:MAX:%6.2lf%s".str_replace("%", "%%", $units)."";
$rrd_options .= " AREA:".$g_defname.$i."#".$colour.":'".$descr."':$stack";
$rrd_options .= " GPRINT:".$t_defname.$i.":LAST:%5.2lf%s GPRINT:".$t_defname.$i."min:MIN:%5.2lf%s";
$rrd_options .= " GPRINT:".$t_defname.$i."max:MAX:%5.2lf%s GPRINT:".$t_defname.$i.":AVERAGE:'%5.2lf%s\\n'";
if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['ds'].$i.":%6.2lf%s".str_replace("%", "%%", $total_units).""; }

View File

@@ -26,7 +26,7 @@ if (is_file($rrd_filename))
$colours = "mixed";
$nototal = 1;
$unit_text = "Errors";
$unit_text = "Errors/sec";
$simple_rrd = 1;
include("includes/graphs/generic_multi_simplex_seperated.inc.php");