mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
git-svn-id: http://www.observium.org/svn/observer/trunk@492 61d68cd4-352d-0410-923a-c4978735b2b8
68 lines
2.2 KiB
PHP
Executable File
68 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
function cpugraphHP ($rrd, $graph , $from, $to, $width, $height)
|
|
{
|
|
global $config;
|
|
$database = "rrd/" . $rrd;
|
|
$optsa = array( "--start", $from, "--width", $width, "--height", $height, "--vertical-label", $vertical, "--alt-autoscale-max",
|
|
"-l 0",
|
|
"-E",
|
|
"--title", $title,
|
|
"DEF:load=$database:LOAD:AVERAGE",
|
|
"AREA:load#FAFDCE:",
|
|
"LINE1.25:load#dd8800:Load",
|
|
"GPRINT:load:LAST:Cur\:%3.2lf",
|
|
"GPRINT:load:AVERAGE:Avg\:%3.2lf",
|
|
"GPRINT:load:MIN:Min\:%3.2lf",
|
|
"GPRINT:load:MAX:Max\:%3.2lf\\n");
|
|
|
|
if($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."",
|
|
"--font", "AXIS:6:".$config['mono_font']."",
|
|
"--font-render-mode", "normal");}
|
|
$opts = array_merge($config['rrdgraph_defaults'], $$optsa, $optsb);
|
|
|
|
$ret = rrd_graph("$graph", $opts, count($opts));
|
|
|
|
if( !is_array($ret) ) {
|
|
$err = rrd_error();
|
|
#echo "rrd_graph() ERROR: $err\n";
|
|
return FALSE;
|
|
} else {
|
|
return $graph;
|
|
}
|
|
}
|
|
|
|
function memgraphHP ($rrd, $graph , $from, $to, $width, $height, $title, $vertical)
|
|
{
|
|
global $config, $installdir;
|
|
$database = "rrd/" . $rrd;
|
|
|
|
$memrrd = $database;
|
|
$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") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."",
|
|
"--font", "AXIS:6:".$config['mono_font']."",
|
|
"--font-render-mode", "normal");}
|
|
|
|
$opts = array_merge($config['rrdgraph_defaults'], $$opts, $optsb);
|
|
|
|
$ret = rrd_graph("$graph", $opts, count($opts));
|
|
|
|
if( !is_array($ret) ) {
|
|
$err = rrd_error();
|
|
#echo "rrd_graph() ERROR: $err\n";
|
|
return FALSE;
|
|
} else {
|
|
return $graph;
|
|
}
|
|
|
|
}
|
|
|