separate and improve overview page

git-svn-id: http://www.observium.org/svn/observer/trunk@515 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-11-11 18:20:32 +00:00
parent 8040941635
commit 08ae40ab1e
17 changed files with 298 additions and 186 deletions

View File

@@ -4,24 +4,20 @@ if($_GET['from']) { $from = mres($_GET['from']); }
if($_GET['to']) { $to = mres($_GET['to']); }
if($_GET['width']) { $width = mres($_GET['width']); }
if($_GET['height']) { $height = mres($_GET['height']); }
if($_GET['bg']) { $bg = mres($_GET['bg']); }
if($_GET['inverse']) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
if($_GET['legend'] == "no") { $rrd_options = " -g"; }
#if($bg) { $rrd_options .= " -c CANVAS#" . $bg . " "; }
if(!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
if(isset($scale_min)) { $rrd_options .= " -l $scale_min"; }
if(isset($scale_max)) { $rrd_options .= " -u $scale_max"; }
$rrd_options .= " -E --start ".$from." --end " . ($to - 150) . " --width ".$width." --height ".$height." ";
$rrd_options .= $config['rrdgraph_def_text'];
$rrd_options .= " -c BACK#FFFFFF";
if($_GET['bg']) { $rrd_options .= " -c CANVAS#" . mres($_GET['bg']) . " "; }
#$rrd_options .= " -c BACK#FFFFFF";
if($height < "99") { $rrd_options .= " --only-graph"; }
if($width <= "300") { $rrd_options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal";

View File

@@ -9,8 +9,8 @@ while($proc = mysql_fetch_array($query)) {
if(is_file($rrd_filename)) {
$descr = str_pad($proc['hrDeviceDescr'], 8);
$descr = substr($descr,0,8);
$descr = short_hrDeviceDescr($proc['hrDeviceDescr']);
$descr = str_replace(":", "\:", $descr);
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $descr;

View File

@@ -2,13 +2,13 @@
include("common.inc.php");
$unit_text = str_pad($unit_text, 10);
$unit_text = substr($unit_text,0,10);
$unit_text = str_pad($unit_text, 13);
$unit_text = substr($unit_text,0,13);
$i = 0;
$iter = 0;
$rrd_options .= " COMMENT:'".$unit_text." Last Min Max Avg\\n'";
$rrd_options .= " COMMENT:'".$unit_text." Cur Min Max Avg\\n'";
foreach($rrd_list as $rrd) {
@@ -20,12 +20,16 @@
$filename = $rrd['filename'];
$descr = $rrd['descr'];
$id = $rra."_".$i;
$descr = substr(str_pad(short_hrDeviceDescr($rrd['descr']), 10),0,10);
$id = $rra."_".$i;
$rrd_options .= " DEF:".$id."=$filename:$rra:AVERAGE";
$rrd_options .= " DEF:".$id."min=$filename:$rra:MIN";
$rrd_options .= " DEF:".$id."max=$filename:$rra:MAX";
$rrd_options .= " LINE1.25:".$id."#".$colour.":'$descr'";
$rrd_options .= " GPRINT:".$id.":LAST:%6.2lf GPRINT:".$id.":AVERAGE:%6.2lf";
$rrd_options .= " GPRINT:".$id.":MAX:%6.2lf GPRINT:".$id.":AVERAGE:%6.2lf\\\\n";
$rrd_options .= " GPRINT:".$id.":LAST:%6.2lf GPRINT:".$id."min:MIN:%6.2lf";
$rrd_options .= " GPRINT:".$id."max:MAX:%6.2lf GPRINT:".$id.":AVERAGE:%6.2lf\\\\n";
$i++; $iter++;
}

View File

@@ -13,8 +13,7 @@ include("common.inc.php");
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$proc['descr_fixed'] = str_pad($proc['hrDeviceDescr'], 28);
$proc['descr_fixed'] = substr($proc['descr_fixed'],0,28);
$proc['descr_fixed'] = substr(str_pad(short_hrDeviceDescr($proc['hrDeviceDescr']), 28),0,28);
$proc['descr_fixed'] = str_replace(":", "\:", $proc['descr_fixed']);
$rrd = $config['rrd_dir'] . "/".$proc['hostname']."/hrProcessor-" . $proc['hrDeviceIndex'] . ".rrd";
$rrd_options .= " DEF:proc" . $proc['hrDeviceIndex'] . "=$rrd:usage:AVERAGE ";