From ececd2f8f69457cbc6391892d068adaff25f1dbd Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 25 Oct 2011 09:47:45 +0000 Subject: [PATCH] improve generic_multi_simplex_seperated git-svn-id: http://www.observium.org/svn/observer/trunk@2698 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../graphs/generic_multi_line.inc.php | 1 - .../generic_multi_simplex_seperated.inc.php | 35 ++++++++++++++----- html/includes/graphs/port/etherlike.inc.php | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/html/includes/graphs/generic_multi_line.inc.php b/html/includes/graphs/generic_multi_line.inc.php index e60ab61b33..05e660373a 100644 --- a/html/includes/graphs/generic_multi_line.inc.php +++ b/html/includes/graphs/generic_multi_line.inc.php @@ -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") { diff --git a/html/includes/graphs/generic_multi_simplex_seperated.inc.php b/html/includes/graphs/generic_multi_simplex_seperated.inc.php index d67f457ae5..9de7e3eb92 100644 --- a/html/includes/graphs/generic_multi_simplex_seperated.inc.php +++ b/html/includes/graphs/generic_multi_simplex_seperated.inc.php @@ -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).""; } diff --git a/html/includes/graphs/port/etherlike.inc.php b/html/includes/graphs/port/etherlike.inc.php index 9566a89829..e280934629 100644 --- a/html/includes/graphs/port/etherlike.inc.php +++ b/html/includes/graphs/port/etherlike.inc.php @@ -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");