mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add Screenos stuff
git-svn-id: http://www.observium.org/svn/observer/trunk@176 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -169,7 +169,7 @@ if($_SESSION['userlevel'] >= '5') {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
|
||||
"<img src='http://network.vostron.net/graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@ $hostname = gethostbyid($_GET[id]);
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' ORDER BY 'ifIndex'");
|
||||
$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' ORDER BY `ifDescr` ASC");
|
||||
while($interface = mysql_fetch_array($interface_query)) {
|
||||
include("includes/print-interface.inc");
|
||||
}
|
||||
|
@@ -137,7 +137,7 @@ function graph_device_bits ($device, $graph, $from, $to, $width, $height) {
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
|
||||
$hostname = gethostbyid($device);
|
||||
$query = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%'");
|
||||
$query = mysql_query("SELECT `ifIndex` FROM `interfaces` WHERE `device_id` = '$device' AND `ifType` NOT LIKE '%oopback%' AND `ifType` NOT LIKE '%SVI%' AND `ifType` != 'l2vlan'");
|
||||
if($width <= "300") { $options .= "--font LEGEND:7:$mono_font --font AXIS:6:$mono_font --font-render-mode normal "; }
|
||||
$pluses = "";
|
||||
while($int = mysql_fetch_row($query)) {
|
||||
|
76
includes/graphing/screenos.php
Normal file
76
includes/graphing/screenos.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
function graph_netscreen_sessions ($rrd, $graph, $from, $to, $width, $height, $title=NULL, $vertical=NULL) {
|
||||
global $config;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$options = "-Y -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:alloc=$database:allocate:AVERAGE";
|
||||
$options .= " DEF:max=$database:max:AVERAGE";
|
||||
$options .= " DEF:failed=$database:failed:AVERAGE";
|
||||
$options .= " COMMENT:Sessions\ \ \ \ \ \ Current\ \ \ \ Average\ \ \ \ Maximum\\\\n";
|
||||
$options .= " LINE1.25:max#cc0000:Supported";
|
||||
$options .= " GPRINT:max:MAX:\ %6.0lf\\\\n";
|
||||
$options .= " LINE1.25:alloc#006600:Allocated";
|
||||
$options .= " GPRINT:alloc:LAST:\ %6.0lf";
|
||||
$options .= " GPRINT:alloc:AVERAGE:\ \ \ %6.0lf";
|
||||
$options .= " GPRINT:alloc:MAX:\ \ \ %6.0lf\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
function graph_netscreen_cpu ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $rrdtool, $installdir, $mono_font, $rrd_dir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$period = $to - $from;
|
||||
$options = "-Y -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:av=$database:average:AVERAGE";
|
||||
$options .= " DEF:5m=$database:5min:AVERAGE";
|
||||
$options .= " COMMENT:Usage\ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
|
||||
$options .= " AREA:5m#eeee00";
|
||||
$options .= " LINE1.25:5m#aa2000:5min";
|
||||
$options .= " GPRINT:5m:LAST:\ \ \ \ \ %5.2lf%%";
|
||||
$options .= " GPRINT:5m:AVERAGE:\ \ \ %5.2lf%%";
|
||||
$options .= " GPRINT:5m:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||
$options .= " LINE1.25:av#2020c0:Average";
|
||||
$options .= " GPRINT:av:LAST:\ \ %5.2lf%%";
|
||||
$options .= " GPRINT:av:AVERAGE:\ \ \ %5.2lf%%";
|
||||
$options .= " GPRINT:av:MAX:\ \ \ %5.2lf%%\\\\n";
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
function graph_netscreen_memory ($rrd, $graph, $from, $to, $width, $height, $title=NULL, $vertical=NULL) {
|
||||
global $config;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$options = "-Y -E --start $from --end $to --width $width --height $height ";
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$options .= " DEF:alloc=$database:allocate:AVERAGE";
|
||||
$options .= " DEF:left=$database:left:AVERAGE";
|
||||
$options .= " DEF:frag=$database:frag:AVERAGE";
|
||||
$options .= " CDEF:total=alloc,left,+";
|
||||
$options .= " COMMENT:Memory\ \ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
|
||||
$options .= " AREA:alloc#ffcccc";
|
||||
$options .= " LINE1.25:alloc#cc0000:Allocated";
|
||||
$options .= " GPRINT:alloc:MAX:%6.2lf%sB";
|
||||
$options .= " GPRINT:alloc:AVERAGE:\ %6.2lf%sB";
|
||||
$options .= " GPRINT:alloc:MAX:\ %6.2lf%sB\\\\n";
|
||||
$options .= " LINE1.25:left#006600:Left";
|
||||
$options .= " GPRINT:left:LAST:\ \ \ \ \ %6.2lf%sB";
|
||||
$options .= " GPRINT:left:AVERAGE:\ %6.2lf%sB";
|
||||
$options .= " GPRINT:left:MAX:\ %6.2lf%sB\\\\n";
|
||||
$options .= " LINE1.25:frag#666600:Fragments";
|
||||
$options .= " GPRINT:frag:LAST:%6.2lf%sB";
|
||||
$options .= " GPRINT:frag:AVERAGE:\ %6.2lf%sB";
|
||||
$options .= " GPRINT:frag:MAX:\ %6.2lf%sB\\\\n";
|
||||
|
||||
shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user