ok not all graphs, but a few more (atleast cpu, mem and bits for device overlibs)

git-svn-id: http://www.observium.org/svn/observer/trunk@1630 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-08-02 22:50:42 +00:00
parent 0d6810c85a
commit c3eae27d25
4 changed files with 27 additions and 22 deletions

View File

@@ -15,15 +15,18 @@ while($mempool = mysql_fetch_array($query)) {
} elseif($iter=="7") {$colour="FF0084"; unset($iter); } } elseif($iter=="7") {$colour="FF0084"; unset($iter); }
$descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 28),0,28); $descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 28),0,28);
$descr = str_replace(":", "\:", $descr); $descr = str_replace(":", "\:", $descr);
$rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd"); $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
$rrd_options .= " DEF:mempoolfree$i=$rrd:free:AVERAGE "; if(is_file($rrd_filename))
$rrd_options .= " DEF:mempoolused$i=$rrd:used:AVERAGE "; {
$rrd_options .= " DEF:mempoolfree$i=$rrd_filename:free:AVERAGE ";
$rrd_options .= " DEF:mempoolused$i=$rrd_filename:used:AVERAGE ";
$rrd_options .= " CDEF:mempooltotal$i=mempoolused$i,mempoolused$i,mempoolfree$i,+,/,100,* "; $rrd_options .= " CDEF:mempooltotal$i=mempoolused$i,mempoolused$i,mempoolfree$i,+,/,100,* ";
$rrd_options .= " LINE1:mempooltotal$i#" . $colour . ":'" . $descr . "' "; $rrd_options .= " LINE1:mempooltotal$i#" . $colour . ":'" . $descr . "' ";
$rrd_options .= " GPRINT:mempooltotal$i:LAST:%3.0lf"; $rrd_options .= " GPRINT:mempooltotal$i:LAST:%3.0lf";
$rrd_options .= " GPRINT:mempooltotal$i:MAX:%3.0lf\\\l "; $rrd_options .= " GPRINT:mempooltotal$i:MAX:%3.0lf\\\l ";
$iter++; $i++; $iter++; $i++;
} }
}
$rrd_options .= " HRULE:0#999999"; $rrd_options .= " HRULE:0#999999";
?> ?>

View File

@@ -17,6 +17,8 @@ foreach($rrd_filenames as $rrd_filename) {
$i++; $i++;
} }
if($i)
{
if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
$rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses; $rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
$rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses; $rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
@@ -42,7 +44,8 @@ if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; $rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s\\\l"; $rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s\\\l";
} }
$rrd_options .= " HRULE:0#999999"; }
#$rrd_options .= " HRULE:0#999999";
?> ?>

View File

@@ -81,7 +81,7 @@ function graph_error ($string)
{ {
global $width, $height; global $width, $height;
header('Content-type: image/png'); header('Content-type: image/png');
if($height > "99") { $width +=79; } if($height > "99") { $width +=76; }
$im = imagecreate($width, $height); $im = imagecreate($width, $height);
$orange = imagecolorallocate($im, 255, 225, 225); $orange = imagecolorallocate($im, 255, 225, 225);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2; $px = (imagesx($im) - 7.5 * strlen($string)) / 2;
@@ -91,7 +91,6 @@ function graph_error ($string)
exit(); exit();
} }
if(!$auth) if(!$auth)
{ {
if($width < 200) if($width < 200)
@@ -101,6 +100,7 @@ if(!$auth)
graph_error("No Authorisation"); graph_error("No Authorisation");
} }
} else { } else {
$rrd_options .= " HRULE:0#999999";
if($no_file) if($no_file)
{ {
if($width < 200) if($width < 200)
@@ -113,7 +113,6 @@ if(!$auth)
if($rrd_options) if($rrd_options)
{ {
if($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; } if($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; }
$rrd_options .= " HRULE:0#999999";
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches; $rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
$woo = shell_exec($rrd_cmd); $woo = shell_exec($rrd_cmd);
if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); } if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }

View File

@@ -16,6 +16,6 @@ $colour_area_out_max = "FFefaa";
$graph_max = 1; $graph_max = 1;
$unit_text = "Packets"; $unit_text = "Packets";
include("includes/graphs/generic_duplex.inc.php"); #include("includes/graphs/generic_duplex.inc.php");
?> ?>