git-svn-id: http://www.observium.org/svn/observer/trunk@118 61d68cd4-352d-0410-923a-c4978735b2b8

This commit is contained in:
Adam Amstrong
2007-11-23 11:37:28 +00:00
parent 9a6d196f32
commit 89b6a9bf1a
28 changed files with 1275 additions and 1379 deletions
+24 -19
View File
@@ -2,7 +2,7 @@
function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
{
global $rrdtool, $installdir, $mono_font;
global $config,$rrdtool, $installdir, $mono_font;
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
@@ -21,7 +21,7 @@ function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
if($width <= "300") {$optsb = array("--font", "LEGEND:7:$mono_font",
"--font", "AXIS:6:$mono_font",
"--font-render-mode", "normal");}
$opts = array_merge($optsa, $optsb);
$opts = array_merge($config['rrdgraph_defaults'], $$optsa, $optsb);
$ret = rrd_graph("$imgfile", $opts, count($opts));
@@ -36,29 +36,34 @@ function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
function memgraphHP ($rrd, $graph , $from, $to, $width, $height, $title, $vertical)
{
global $rrdtool, $installdir, $mono_font;
global $config,$rrdtool, $installdir, $mono_font;
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$memrrd = $database;
$opts = "--start $from \
--alt-autoscale-max \
--width $width --height $height \
-l 0 -E \
-b 1024 \
DEF:TOTAL=$memrrd:TOTAL:AVERAGE \
DEF:FREE=$memrrd:FREE:AVERAGE \
DEF:USED=$memrrd:USED:AVERAGE \
AREA:USED#ee9900:Used \
AREA:FREE#FAFDCE:Free:STACK \
LINE1.5:TOTAL#cc0000:";
$opts = array("--start", "$from", "--alt-autoscale-max", "--width", "$width", "--height", "$height",
"-l", "0", "-E", "-b", "1024",
"DEF:TOTAL=$memrrd:TOTAL:AVERAGE",
"DEF:FREE=$memrrd:FREE:AVERAGE",
"DEF:USED=$memrrd:USED:AVERAGE",
"AREA:USED#ee9900:Used",
"AREA:FREE#FAFDCE:Free:STACK",
"LINE1.5:TOTAL#cc0000:");
if($width <= "300") {$opts .= "\
--font LEGEND:7:$mono_font \
--font AXIS:6:$mono_font \
--font-render-mode normal";}
if($width <= "300") {$optsb = array("--font", "LEGEND:7:$mono_font",
"--font", "AXIS:6:$mono_font",
"--font-render-mode", "normal");}
$opts = array_merge($config['rrdgraph_defaults'], $$opts, $optsb);
`$rrdtool graph $imgfile $opts`;
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
#echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $imgfile;
}
}