mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -15,14 +15,17 @@ while($mempool = mysql_fetch_array($query)) {
|
||||
} elseif($iter=="7") {$colour="FF0084"; unset($iter); }
|
||||
$descr = substr(str_pad(short_hrDeviceDescr($mempool['mempool_descr']), 28),0,28);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
$rrd = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
|
||||
$rrd_options .= " DEF:mempoolfree$i=$rrd:free:AVERAGE ";
|
||||
$rrd_options .= " DEF:mempoolused$i=$rrd:used:AVERAGE ";
|
||||
$rrd_options .= " CDEF:mempooltotal$i=mempoolused$i,mempoolused$i,mempoolfree$i,+,/,100,* ";
|
||||
$rrd_options .= " LINE1:mempooltotal$i#" . $colour . ":'" . $descr . "' ";
|
||||
$rrd_options .= " GPRINT:mempooltotal$i:LAST:%3.0lf";
|
||||
$rrd_options .= " GPRINT:mempooltotal$i:MAX:%3.0lf\\\l ";
|
||||
$iter++; $i++;
|
||||
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
|
||||
if(is_file($rrd_filename))
|
||||
{
|
||||
$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 .= " LINE1:mempooltotal$i#" . $colour . ":'" . $descr . "' ";
|
||||
$rrd_options .= " GPRINT:mempooltotal$i:LAST:%3.0lf";
|
||||
$rrd_options .= " GPRINT:mempooltotal$i:MAX:%3.0lf\\\l ";
|
||||
$iter++; $i++;
|
||||
}
|
||||
}
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
|
||||
|
@@ -7,17 +7,19 @@ include("includes/graphs/common.inc.php");
|
||||
|
||||
$i=0;
|
||||
foreach($rrd_filenames as $rrd_filename) {
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=".$rrd_filename.":".$rra_in.":AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=".$rrd_filename.":".$rra_out.":AVERAGE";
|
||||
$in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$out_thing .= $seperator . "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
$pluses .= $plus;
|
||||
$seperator = ",";
|
||||
$plus = ",+";
|
||||
$i++;
|
||||
$rrd_options .= " DEF:inoctets" . $i . "=".$rrd_filename.":".$rra_in.":AVERAGE";
|
||||
$rrd_options .= " DEF:outoctets" . $i . "=".$rrd_filename.":".$rra_out.":AVERAGE";
|
||||
$in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||
$out_thing .= $seperator . "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
|
||||
$pluses .= $plus;
|
||||
$seperator = ",";
|
||||
$plus = ",+";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
|
||||
if($i)
|
||||
{
|
||||
if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
|
||||
$rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
|
||||
$rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
|
||||
$rrd_options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
@@ -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:MAX:%6.2lf%s\\\l";
|
||||
}
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
}
|
||||
#$rrd_options .= " HRULE:0#999999";
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -81,7 +81,7 @@ function graph_error ($string)
|
||||
{
|
||||
global $width, $height;
|
||||
header('Content-type: image/png');
|
||||
if($height > "99") { $width +=79; }
|
||||
if($height > "99") { $width +=76; }
|
||||
$im = imagecreate($width, $height);
|
||||
$orange = imagecolorallocate($im, 255, 225, 225);
|
||||
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
||||
@@ -91,7 +91,6 @@ function graph_error ($string)
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if(!$auth)
|
||||
{
|
||||
if($width < 200)
|
||||
@@ -101,6 +100,7 @@ if(!$auth)
|
||||
graph_error("No Authorisation");
|
||||
}
|
||||
} else {
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
if($no_file)
|
||||
{
|
||||
if($width < 200)
|
||||
@@ -113,7 +113,6 @@ if(!$auth)
|
||||
if($rrd_options)
|
||||
{
|
||||
if($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; }
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
||||
$woo = shell_exec($rrd_cmd);
|
||||
if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }
|
||||
|
@@ -16,6 +16,6 @@ $colour_area_out_max = "FFefaa";
|
||||
$graph_max = 1;
|
||||
$unit_text = "Packets";
|
||||
|
||||
include("includes/graphs/generic_duplex.inc.php");
|
||||
#include("includes/graphs/generic_duplex.inc.php");
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user