mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
numerous updates! :D
git-svn-id: http://www.observium.org/svn/observer/trunk@440 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+1
-4
@@ -123,10 +123,7 @@ $list_colour_a_b = "#f0f0f0";
|
||||
$list_colour_b_a = "#e9e9e9";
|
||||
$list_colour_b_b = "#e0e0e0";
|
||||
|
||||
|
||||
$warn_colour_a = "#ffeeee";
|
||||
$warn_colour_b = "#ffcccc";
|
||||
|
||||
$list_highlight = "#ffcccc";
|
||||
|
||||
$warn_colour_a = "#ffeeee";
|
||||
$warn_colour_b = "#ffcccc";
|
||||
|
||||
+6
-2
@@ -8,6 +8,9 @@ RewriteCond %{REQUEST_URI} !^(.*)\.jpg$
|
||||
RewriteCond %{REQUEST_URI} !^(.*)\.gif$
|
||||
RewriteCond %{REQUEST_URI} !^(.*)\.png$
|
||||
|
||||
RewriteRule ^bare/(.+)/ index-bare.php?page=$1
|
||||
|
||||
|
||||
## Rewrites for Devices
|
||||
|
||||
RewriteRule ^devices/location/(.+)/ ?page=devices&location=$1
|
||||
@@ -24,12 +27,13 @@ RewriteRule ^vrf/(.+)/ ?page=vrf&id=$1
|
||||
|
||||
RewriteRule ^bill/([0-9]+) ?page=bills&bill=$1
|
||||
|
||||
RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4&optc=$5
|
||||
RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4
|
||||
RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3
|
||||
RewriteRule ^device/([0-9]+)/([a-z]+)/ ?page=device&id=$1§ion=$2
|
||||
RewriteRule ^device/([0-9]+) ?page=device&id=$1
|
||||
|
||||
RewriteRule ^([a-z]+)/$ ?page=$1
|
||||
RewriteRule ^([a-z|0-9]+)/$ ?page=$1
|
||||
|
||||
RewriteRule ^([a-z]+)/(.+)/$ ?page=$1&opta=$2
|
||||
RewriteRule ^([a-z|0-9]+)/(.+)/$ ?page=$1&opta=$2
|
||||
|
||||
|
||||
@@ -765,5 +765,6 @@ color: #cc0000;
|
||||
width: 1175px;
|
||||
margin-bottom: 1em;
|
||||
padding: 10px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,15 @@ if($_GET['debug']) {
|
||||
if($_GET['if']) { $_GET['interfaces'] = $_GET['if']; }
|
||||
$graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
||||
break;
|
||||
case 'multi_bits_duo':
|
||||
$groups = array($_GET['interfaces'], $_GET['interfaces_b']);
|
||||
$graph = graph_multi_bits_duo ($groups, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
||||
break;
|
||||
case 'multi_bits_trio':
|
||||
$groups = array($_GET['interfaces'], $_GET['interfaces_b'], $_GET['interfaces_c']);
|
||||
$graph = graph_multi_bits_trio ($groups, $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
|
||||
break;
|
||||
|
||||
case 'adsl_rate':
|
||||
$graph = graph_adsl_rate ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
|
||||
break;
|
||||
|
||||
@@ -7,19 +7,13 @@
|
||||
|
||||
$if_id = $interface['interface_id'];
|
||||
|
||||
|
||||
# $ifType = fixiftype($interface['ifType']);
|
||||
# $ifHardType = $interface['ifHardType'];
|
||||
|
||||
if($bg == "#e5e5e5") { $bg = "#ffffff"; } else { $bg="#e5e5e5"; }
|
||||
if($int_colour) { $bg = $int_colour; }
|
||||
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
|
||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
||||
} else { $error_img = ""; }
|
||||
|
||||
|
||||
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='#fdd';\" onmouseout=\"this.style.backgroundColor='$bg';\" onclick=\"location.href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/'\" style='cursor: hand;'>
|
||||
echo("<tr style=\"background-color: $row_colour; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" onclick=\"location.href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/'\" style='cursor: hand;'>
|
||||
<td valign=top width=300>");
|
||||
|
||||
echo(" <span class=list-large>
|
||||
@@ -210,9 +204,4 @@ echo("</td>");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -130,6 +130,10 @@ if($config['enable_pseudowires']) { echo("<li><a href='pseudowires/'><img src='i
|
||||
|
||||
if($config['enable_pseudowires']) { echo("<li><a href='vrfs/'><img src='images/16/layers.png' border=0 align=absmiddle> VRFs</a></li>"); $ifbreak = 1;}
|
||||
|
||||
?>
|
||||
<li><a href='ipv4/'><img src='images/16/email_link.png' border=0 align=absmiddle> IP Search</a></li>
|
||||
|
||||
<?php
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
echo("<li><hr width=140 /></li>");
|
||||
@@ -152,6 +156,8 @@ echo("<li><a href='?page=interfaces&status=0'><img src='images/16/link_error.png
|
||||
<li><a href='interfaces/down/'><img src='images/16/if-disconnect.png' border=0 align=absmiddle> Down</a></li>
|
||||
<li><a href='interfaces/admindown/'><img src='images/16/if-disable.png' border=0 align=absmiddle> Disabled</a></li>
|
||||
|
||||
|
||||
|
||||
</ul></td></tr></table>
|
||||
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
@@ -195,7 +201,7 @@ echo(" <li><hr /></li>
|
||||
?>
|
||||
|
||||
|
||||
<li style='float: right;'><a><img src='images/16/wrench.png' border=0 align=absmiddle> Configuration
|
||||
<li style='float: right;'><a><img src='images/16/wrench.png' border=0 align=absmiddle> System
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
@@ -203,7 +209,7 @@ echo(" <li><hr /></li>
|
||||
<?php if($_SESSION['userlevel'] >= '10') {
|
||||
echo("
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href='?page=settings'><img src='images/16/report.png' border=0 align=absmiddle> System Settings</a></li>
|
||||
<li><a href='?page=statistics'><img src='images/16/report.png' border=0 align=absmiddle> Statistics</a></li>
|
||||
<li><hr width=140/></li>
|
||||
<li><a href='?page=adduser'><img src='images/16/user_add.png' border=0 align=absmiddle> Add User</a></li>
|
||||
<li><a href='?page=deluser'><img src='images/16/user_delete.png' border=0 align=absmiddle> Remove User</a></li>
|
||||
|
||||
@@ -67,7 +67,11 @@ function dhtml_response_list(&$items, $method) {
|
||||
if($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); }
|
||||
|
||||
foreach ($typeinstances as &$tinst) {
|
||||
if($tinst) {
|
||||
echo("<div><h3>".$_GET['opta']." $instance - $type - $tinst</h3>");
|
||||
} else {
|
||||
echo("<div><h3>".$_GET['opta']." $instance - $type</h3>");
|
||||
}
|
||||
|
||||
$daily_traffic = $config['base_url'] . "/collectd-graph.php?host=" . $device['hostname'] . "&plugin=".$_GET['opta']."&type=".$_GET['opta']."&plugin_instance=".$instance."&type=".$type."&type_instance=".$tinst."×pan=day&to=$now&width=215&height=100";
|
||||
$daily_traffic .= $args;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
echo("<div style='width: 100%; text-align: right; padding-bottom: 10px; clear: both; display:block; height:20px;'>
|
||||
<a href='device/".$interface['device_id']."/interface/".$interface['interface_id']."/macaccounting/'>Full</a> |
|
||||
<a href='device/".$interface['device_id']."/interface/".$interface['interface_id']."/macaccounting/thumbs/'>Compact</a>
|
||||
</div> ");
|
||||
|
||||
|
||||
$hostname = $device['hostname'];
|
||||
$hostid = $device['interface_id'];
|
||||
@@ -22,6 +28,8 @@
|
||||
|
||||
$query = mysql_query("SELECT *, (M.bps_in + M.bps_out) as bps FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id ORDER BY bps DESC");
|
||||
|
||||
echo("<div style='clear: both;'>");
|
||||
|
||||
while($acc = mysql_fetch_array($query)) {
|
||||
|
||||
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
|
||||
@@ -37,12 +45,30 @@
|
||||
|
||||
} else { unset ($peer_info); }
|
||||
|
||||
echo("<div style='background-color: $bg; padding: 8px;'>");
|
||||
|
||||
if($peer_info) { $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; } else {
|
||||
unset ($as); unset ($astext);
|
||||
unset ($as); unset ($astext); unset($asn);
|
||||
}
|
||||
|
||||
if($_GET['optc'] == "thumbs") {
|
||||
|
||||
if(!$asn) { $asn = "No Session"; }
|
||||
|
||||
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 223px; max-width:223px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e5e5e5;'>
|
||||
".$addy['ipv4_address']." - ".$asn."
|
||||
<a href='#' onmouseover=\"return overlib('\
|
||||
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #555555;\'>".$name." - ".$addy['ipv4_address']." - ".$asn."</div>\
|
||||
<img src=\'graph.php?id=" . $acc['ma_id'] . "&type=mac_acc&from=-2day&to=$now&width=450&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >
|
||||
<img src='graph.php?id=" . $acc['ma_id'] . "&type=mac_acc&from=-2day&to=$now&width=215&height=45'></a>
|
||||
|
||||
<span style='font-size: 10px;'>".$name."</span>
|
||||
</div>");
|
||||
|
||||
} else {
|
||||
|
||||
echo("<div style='background-color: $bg; padding: 8px;'>");
|
||||
|
||||
echo("
|
||||
<table>
|
||||
<tr>
|
||||
@@ -86,4 +112,6 @@
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,14 +1,44 @@
|
||||
<?php
|
||||
echo("
|
||||
<div style='width: 100%; text-align: right; padding-bottom: 10px; clear: both; display:block; height:20px;'>
|
||||
<div style='background-color: ".$list_colour_b."; margin: auto; text-align: left; padding: 7px; clear: both; display:block; height:20px;'>
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/'>Basic</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/details/'>Details</a> | Graphs:
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/'>Bits</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/'>Bits</a>
|
||||
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/bits/thumbs/'>Compact</a>) |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/pkts/'>Packets</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/nupkts/'>NU Packets</a> |
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/errors/'>Errors</a>
|
||||
</div> ");
|
||||
|
||||
if($_GET['optc'] == thumbs) {
|
||||
|
||||
$timeperiods = array('-1day','-1week','-1month','-1year');
|
||||
|
||||
$from = '-1day';
|
||||
|
||||
echo("<div style='display: block; clear: both; margin: auto; background-color: black;'>");
|
||||
|
||||
$sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
|
||||
$query = mysql_query($sql);
|
||||
unset ($seperator);
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
|
||||
<div style='font-weight: bold;'>".makeshortif($interface['ifDescr'])."</div>
|
||||
<a href='device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('\
|
||||
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$interface['ifDescr']."</div>\
|
||||
".$interface['ifAlias']." \
|
||||
<img src=\'graph.php?type=bits&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=450&height=150\'>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
|
||||
"<img src='graph.php?type=bits&if=".$interface['interface_id']."&from=".$from."&to=".$now."&width=180&height=45&legend=no'>
|
||||
</a>
|
||||
<div style='font-size: 9px;'>".truncate(short_port_descr($interface['ifAlias']), 32, '')."</div>
|
||||
</div>");
|
||||
|
||||
}
|
||||
echo("</div>");
|
||||
|
||||
} else {
|
||||
|
||||
if($_GET['opta'] == graphs ) {
|
||||
if($_GET['optb']) {
|
||||
$graph_type = $_GET['optb'];
|
||||
@@ -30,7 +60,12 @@ $i = "1";
|
||||
$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC");
|
||||
while($interface = mysql_fetch_array($interface_query)) {
|
||||
include("includes/print-interface.inc");
|
||||
$i++;
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
||||
echo("<div style='min-height: 150px;'></div>");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+6
-3
@@ -9,10 +9,10 @@
|
||||
|
||||
echo("<tr valign=top bgcolor='$bg_colour'>");
|
||||
|
||||
echo("<td width=200 class=list-large><a href='vrf/".$vrf['mplsVpnVrfRouteDistinguisher']."/'>" . $vrf['vrf_name'] . "</a></td>");
|
||||
echo("<td width=240><a class=list-large href='vrf/".$vrf['mplsVpnVrfRouteDistinguisher']."/'>" . $vrf['vrf_name'] . "</a><br /><span class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</span></td>");
|
||||
echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</td>");
|
||||
|
||||
echo("<td width=200 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
|
||||
# echo("<td width=200 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
|
||||
|
||||
echo("<td><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
@@ -24,10 +24,13 @@
|
||||
} else {
|
||||
if(!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; }
|
||||
}
|
||||
echo("<tr bgcolor='$dev_colour'><td width=150>".generatedevicelink($device) . "</td><td>");
|
||||
echo("<tr bgcolor='$dev_colour'><td width=150>".generatedevicelink($device));
|
||||
if($device['vrf_name'] != $vrf['vrf_name']) { echo("<a href='#' onmouseover=\" return overlib('Expected Name : ".$vrf['vrf_name']."<br />Configured : ".$device['vrf_name']."', CAPTION, '<span class=list-large>VRF Inconsistency</span>' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> <img align=absmiddle src=images/16/exclamation.png></a>"); }
|
||||
echo("</td><td>");
|
||||
$interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'");
|
||||
unset($seperator);
|
||||
while($interface = mysql_fetch_array($interfaces)) {
|
||||
$interface = array_merge ($device, $interface);
|
||||
echo($seperator.generateiflink($interface,makeshortif($interface['ifDescr'])));
|
||||
$seperator = ", ";
|
||||
}
|
||||
|
||||
@@ -690,21 +690,21 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
|
||||
'DEF:l_max={file}:longterm:MAX',
|
||||
"AREA:s_max#$HalfGreen",
|
||||
"AREA:s_min#$Canvas",
|
||||
"LINE1:s_avg#$FullGreen: 1m average",
|
||||
'GPRINT:s_min:MIN:%4.2lf',
|
||||
'GPRINT:s_avg:AVERAGE:%4.2lf',
|
||||
'GPRINT:s_max:MAX:%4.2lf',
|
||||
'GPRINT:s_avg:LAST:%4.2lf Last\n',
|
||||
"LINE1:m_avg#$FullBlue: 5m average",
|
||||
'GPRINT:m_min:MIN:%4.2lf',
|
||||
'GPRINT:m_avg:AVERAGE:%4.2lf',
|
||||
'GPRINT:m_max:MAX:%4.2lf',
|
||||
'GPRINT:m_avg:LAST:%4.2lf Last\n',
|
||||
"LINE1:s_avg#$FullGreen: 1m average ",
|
||||
'GPRINT:s_min:MIN:%5.2lf',
|
||||
'GPRINT:s_avg:AVERAGE:%5.2lf',
|
||||
'GPRINT:s_max:MAX:%5.2lf',
|
||||
'GPRINT:s_avg:LAST:%5.2lf\\j',
|
||||
"LINE1:m_avg#$FullBlue: 5m average ",
|
||||
'GPRINT:m_min:MIN:%5.2lf',
|
||||
'GPRINT:m_avg:AVERAGE:%5.2lf',
|
||||
'GPRINT:m_max:MAX:%5.2lf',
|
||||
'GPRINT:m_avg:LAST:%5.2lf\\j',
|
||||
"LINE1:l_avg#$FullRed:15m average",
|
||||
'GPRINT:l_min:MIN:%4.2lf',
|
||||
'GPRINT:l_avg:AVERAGE:%4.2lf',
|
||||
'GPRINT:l_max:MAX:%4.2lf',
|
||||
'GPRINT:l_avg:LAST:%4.2lf');
|
||||
'GPRINT:l_min:MIN:%5.2lf',
|
||||
'GPRINT:l_avg:AVERAGE:%5.2lf',
|
||||
'GPRINT:l_max:MAX:%5.2lf',
|
||||
'GPRINT:l_avg:LAST:%5.2lf\\j');
|
||||
$GraphDefs['load_percent'] = array(
|
||||
'DEF:avg={file}:percent:AVERAGE',
|
||||
'DEF:min={file}:percent:MIN',
|
||||
@@ -1396,7 +1396,8 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
|
||||
'GPRINT:s_max:MAX:%5.2lf%s',
|
||||
'GPRINT:s_avg:LAST:%5.2lf%s');
|
||||
$GraphDefs['if_octets'] = array(
|
||||
'-v', 'Bits/s', '--units=si',
|
||||
#'-v', 'Bits/s',
|
||||
'--units=si',
|
||||
'DEF:out_min_raw={file}:tx:MIN',
|
||||
'DEF:out_avg_raw={file}:tx:AVERAGE',
|
||||
'DEF:out_max_raw={file}:tx:MAX',
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
$as_cmd .= ".1.3.6.1.2.1.15.2";
|
||||
$bgpLocalAs = trim(shell_exec($as_cmd));
|
||||
|
||||
if($bgpLocalAs) {
|
||||
if($bgpLocalAs && !strstr($bgpLocalAs, "No")) {
|
||||
|
||||
echo("AS$bgpLocalAs \n");
|
||||
|
||||
|
||||
+312
-12
@@ -5,11 +5,291 @@ include("graphing/fortigate.php");
|
||||
include("graphing/windows.php");
|
||||
include("graphing/unix.php");
|
||||
|
||||
function graph_multi_bits_trio ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
||||
global $config, $installdir;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
|
||||
if($height < "99") { $options .= " --only-graph"; }
|
||||
$i = 1;
|
||||
foreach(explode(",", $interfaces[0]) as $ifid) {
|
||||
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_row($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
|
||||
if(strstr($inverse, "a")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$options .= " DEF:inoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$in."OCTETS:AVERAGE";
|
||||
$options .= " DEF:outoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$out."OCTETS: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++;
|
||||
}
|
||||
}
|
||||
unset($seperator); unset($plus);
|
||||
foreach(explode(",", $interfaces[1]) as $ifid) {
|
||||
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_row($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
|
||||
if(strstr($inverse, "b")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$options .= " DEF:inoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$in."OCTETS:AVERAGE";
|
||||
$options .= " DEF:outoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$out."OCTETS:AVERAGE";
|
||||
$in_thingb .= $seperator . "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$out_thingb .= $seperator . "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
$plusesb .= $plus;
|
||||
$seperator = ",";
|
||||
$plus = ",+";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
unset($seperator); unset($plus);
|
||||
foreach(explode(",", $interfaces[2]) as $ifid) {
|
||||
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_row($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
|
||||
if(strstr($inverse, "c")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
|
||||
$options .= " DEF:inoctetsc" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$in."OCTETS:AVERAGE";
|
||||
$options .= " DEF:outoctetsc" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$out."OCTETS:AVERAGE";
|
||||
$in_thingc .= $seperator . "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
|
||||
$out_thingc .= $seperator . "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $i . ",IF";
|
||||
$plusesc .= $plus;
|
||||
$seperator = ",";
|
||||
$plus = ",+";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$options .= " CDEF:inoctets=" . $in_thing . $pluses;
|
||||
$options .= " CDEF:outoctets=" . $out_thing . $pluses;
|
||||
$options .= " CDEF:inoctetsb=" . $in_thingb . $plusesb;
|
||||
$options .= " CDEF:outoctetsb=" . $out_thingb . $plusesb;
|
||||
$options .= " CDEF:inoctetsc=" . $in_thingc . $plusesc;
|
||||
$options .= " CDEF:outoctetsc=" . $out_thingc . $plusesc;
|
||||
$options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
$options .= " CDEF:inbits=inoctets,8,*";
|
||||
$options .= " CDEF:outbits=outoctets,8,*";
|
||||
$options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
$options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
|
||||
$options .= " CDEF:inbitsb=inoctetsb,8,*";
|
||||
$options .= " CDEF:outbitsb=outoctetsb,8,*";
|
||||
$options .= " CDEF:doutbitsb=doutoctetsb,8,*";
|
||||
$options .= " CDEF:doutoctetsc=outoctetsc,-1,*";
|
||||
$options .= " CDEF:inbitsc=inoctetsc,8,*";
|
||||
$options .= " CDEF:outbitsc=outoctetsc,8,*";
|
||||
$options .= " CDEF:doutbitsc=doutoctetsc,8,*";
|
||||
$options .= " CDEF:inbits_tot=inbits,inbitsb,inbitsc,+,+";
|
||||
$options .= " CDEF:outbits_tot=outbits,outbitsb,outbitsc,+,+";
|
||||
$options .= " CDEF:inbits_stot=inbitsc,inbitsb,+";
|
||||
$options .= " CDEF:outbits_stot=outbitsc,outbitsb,+";
|
||||
$options .= " CDEF:doutbits_stot=outbits_stot,-1,*";
|
||||
$options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
|
||||
$options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
|
||||
|
||||
if($legend == "no") {
|
||||
$options .= " AREA:inbits_tot#cdeb8b:";
|
||||
$options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$options .= " LINE1.25:inbits_tot#aacc77:";
|
||||
$options .= " LINE1.25:doutbits_tot#aacc88:";
|
||||
$options .= " AREA:inbits_stot#c3d9ff:";
|
||||
$options .= " AREA:doutbits_stot#c3d9ff:";
|
||||
$options .= " LINE1:inbits_stot#b3a9cf:";
|
||||
$options .= " LINE1:doutbits_stot#b3a9cf:";
|
||||
$options .= " AREA:inbitsc#ffcc99:";
|
||||
$options .= " AREA:doutbitsc#ffcc99:";
|
||||
$options .= " LINE1.25:inbitsc#ddaa88";
|
||||
$options .= " LINE1.25:doutbitsc#ddaa88";
|
||||
$options .= " LINE1:inbits#006600:";
|
||||
$options .= " LINE1:doutbits#006600:";
|
||||
$options .= " LINE1:inbitsb#000099:";
|
||||
$options .= " LINE1:doutbitsb#000099:";
|
||||
$options .= " LINE0.5:nothing#555555:";
|
||||
} else {
|
||||
$options .= " COMMENT:BPS\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Min\ \ \ \ \ \ Max\\\\n";
|
||||
$options .= " AREA:inbits_tot#cdeb8b:ATM\ \ In\ ";
|
||||
$options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " LINE1.25:inbits_tot#aacc77:";
|
||||
$options .= " LINE1.25:doutbits_tot#aacc88:";
|
||||
$options .= " AREA:inbits_stot#c3d9ff:NGN\ \ In\ ";
|
||||
$options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " AREA:doutbits_stot#c3d9ff:";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " LINE1:inbits_stot#b3a9cf:";
|
||||
$options .= " LINE1:doutbits_stot#b3a9cf:";
|
||||
$options .= " AREA:inbitsc#ffcc99:Wave\ In\ ";
|
||||
$options .= " GPRINT:inbitsc:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsc:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsc:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsc:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " AREA:doutbitsc#ffcc99:";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbitsc:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsc:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsc:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsc:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " LINE1.25:inbitsc#ddaa88";
|
||||
$options .= " LINE1.25:doutbitsc#ddaa88";
|
||||
$options .= " LINE1:inbits#006600:";
|
||||
$options .= " LINE1:doutbits#006600:";
|
||||
$options .= " LINE1:inbitsb#000099:";
|
||||
$options .= " LINE1:doutbitsb#000099:";
|
||||
$options .= " LINE0.5:nothing#555555:";
|
||||
|
||||
$options .= " COMMENT:Total\ \ In\ ";
|
||||
$options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\\\l";
|
||||
|
||||
|
||||
}
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
||||
# echo($config['rrdtool'] . " graph $imgfile $options");
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
|
||||
function graph_multi_bits_duo ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
||||
global $config, $installdir;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
|
||||
if($height < "99") { $options .= " --only-graph"; }
|
||||
$i = 1;
|
||||
foreach(explode(",", $interfaces[1]) as $ifid) {
|
||||
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_row($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
|
||||
$options .= " DEF:inoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE";
|
||||
$options .= " DEF:outoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:OUTOCTETS: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++;
|
||||
}
|
||||
}
|
||||
unset($seperator); unset($plus);
|
||||
foreach(explode(",", $interfaces[0]) as $ifid) {
|
||||
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
$int = mysql_fetch_row($query);
|
||||
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
|
||||
$options .= " DEF:inoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE";
|
||||
$options .= " DEF:outoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:OUTOCTETS:AVERAGE";
|
||||
$in_thingb .= $seperator . "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
|
||||
$out_thingb .= $seperator . "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
|
||||
$plusesb .= $plus;
|
||||
$seperator = ",";
|
||||
$plus = ",+";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
|
||||
$options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
|
||||
$options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
|
||||
$options .= " CDEF:".$in."octetsb=" . $in_thingb . $plusesb;
|
||||
$options .= " CDEF:".$out."octetsb=" . $out_thingb . $plusesb;
|
||||
$options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
$options .= " CDEF:inbits=inoctets,8,*";
|
||||
$options .= " CDEF:outbits=outoctets,8,*";
|
||||
$options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
$options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
|
||||
$options .= " CDEF:inbitsb=inoctetsb,8,*";
|
||||
$options .= " CDEF:outbitsb=outoctetsb,8,*";
|
||||
$options .= " CDEF:doutbitsb=doutoctetsb,8,*";
|
||||
$options .= " CDEF:inbits_tot=inbits,inbitsb,+";
|
||||
$options .= " CDEF:outbits_tot=outbits,outbitsb,+";
|
||||
$options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
|
||||
$options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
|
||||
if($legend == "no") {
|
||||
$options .= " AREA:inbits_tot#cdeb8b:";
|
||||
$options .= " AREA:inbits#ffcc99:";
|
||||
$options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$options .= " AREA:doutbits#ffcc99:";
|
||||
$options .= " LINE1:inbits#aa9966:";
|
||||
$options .= " LINE1:doutbits#aa9966:";
|
||||
$options .= " LINE1:inbitsb#006600:";
|
||||
$options .= " LINE1:doutbitsb#006600:";
|
||||
$options .= " LINE1.25:inbits_tot#006600:";
|
||||
$options .= " LINE1.25:doutbits_tot#006600:";
|
||||
$options .= " LINE0.5:nothing#555555:";
|
||||
} else {
|
||||
$options .= " COMMENT:BPS\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Min\ \ \ \ \ \ Max\\\\n";
|
||||
$options .= " AREA:inbits_tot#cdeb8b:Peering\ In\ ";
|
||||
$options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " AREA:doutbits_tot#cdeb8b:";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\\\l";
|
||||
|
||||
$options .= " AREA:inbits#ffcc99:Transit\ In\ ";
|
||||
$options .= " GPRINT:inbits:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " AREA:doutbits#ffcc99:";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbits:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits:MAX:%6.2lf%s\\\\l";
|
||||
|
||||
$options .= " COMMENT:Total\ \ \ \ \ In\ ";
|
||||
$options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\\\l";
|
||||
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Out";
|
||||
$options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
|
||||
$options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\\\l";
|
||||
|
||||
$options .= " LINE1:inbits#aa9966:";
|
||||
$options .= " LINE1:doutbits#aa9966:";
|
||||
$options .= " LINE1.25:inbitsb#006600:";
|
||||
$options .= " LINE1.25:doutbitsb#006600:";
|
||||
$options .= " LINE1.25:inbits_tot#006600:";
|
||||
$options .= " LINE1.25:doutbits_tot#006600:";
|
||||
$options .= " LINE0.5:nothing#555555:";
|
||||
|
||||
}
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
|
||||
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
|
||||
function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
|
||||
global $config, $installdir;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
|
||||
if($height < "33") { $options .= " --only-graph"; }
|
||||
if($height < "99") { $options .= " --only-graph"; }
|
||||
$i = 1;
|
||||
foreach(explode(",", $interfaces) as $ifid) {
|
||||
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `interfaces` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
|
||||
@@ -95,6 +375,7 @@ function graph_cpmCPU ($id, $graph, $from, $to, $width, $height, $title, $vertic
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
@@ -124,6 +405,7 @@ function graph_device_cpmCPU ($device, $graph, $from, $to, $width, $height, $tit
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
@@ -151,6 +433,7 @@ function graph_device_cempMemPool ($device, $graph, $from, $to, $width, $height,
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
@@ -227,6 +510,7 @@ function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $
|
||||
global $config, $installdir;
|
||||
$options = "--start $from --end $to --width $width --height $height --vertical-label '$vertical' --alt-autoscale-max ";
|
||||
$options .= " -l 0 -E -b 1024 --title '$title' ";
|
||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
$hostname = gethostbyid($device);
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
@@ -269,16 +553,27 @@ function graph_device_bits ($device, $graph, $from, $to, $width, $height, $title
|
||||
}
|
||||
|
||||
function graph_mac_acc ($id, $graph, $from, $to, $width, $height) {
|
||||
global $config;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
$acc = mysql_fetch_array($query);
|
||||
$database = $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
return graph_bits ($database, $graph, $from, $to, $width, $height, $title, $vertical);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function graph_mac_acc_old ($id, $graph, $from, $to, $width, $height) {
|
||||
global $config;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.ma_id = '".$id."' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
$acc = mysql_fetch_array($query);
|
||||
$database = $config['rrd_dir'] . "/" . $acc['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
|
||||
if($height < "33") { $options .= " --only-graph"; }
|
||||
if($height < "99") { $options .= " --only-graph"; }
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($height < "33") { $options .= " --only-graph"; }
|
||||
if($height < "99") { $options .= " --only-graph"; }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
|
||||
$options .= " DEF:inoctets=$database:IN:AVERAGE";
|
||||
@@ -320,7 +615,7 @@ function graph_mac_acc_interface ($interface, $graph, $from, $to, $width, $heigh
|
||||
global $config, $installdir;
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
|
||||
if($height < "33") { $options .= " --only-graph"; }
|
||||
if($height < "99") { $options .= " --only-graph"; }
|
||||
$hostname = gethostbyid($device);
|
||||
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `interfaces` AS I, `devices` AS D WHERE M.interface_id = '$interface' AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
|
||||
if($width <= "300") { $options .= "--font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
@@ -362,7 +657,7 @@ function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertica
|
||||
$imgfile = $config['install_dir'] . "/graphs/" . "$graph";
|
||||
$period = $to - $from;
|
||||
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
|
||||
if($height < "33") { $options .= " --only-graph"; unset ($legend); }
|
||||
if($height < "99") { $options .= " --only-graph"; unset ($legend); }
|
||||
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
if($inverse) {
|
||||
$in = 'out';
|
||||
@@ -371,10 +666,17 @@ function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertica
|
||||
$in = 'in';
|
||||
$out = 'out';
|
||||
}
|
||||
$options .= " DEF:".$out."octets=$database:OUTOCTETS:AVERAGE";
|
||||
$options .= " DEF:".$in."octets=$database:INOCTETS:AVERAGE";
|
||||
$options .= " DEF:".$out."octets_max=$database:OUTOCTETS:MAX";
|
||||
$options .= " DEF:".$in."octets_max=$database:INOCTETS:MAX";
|
||||
if(strstr($database, "mac-accounting")) {
|
||||
$options .= " DEF:".$out."octets=$database:OUT:AVERAGE";
|
||||
$options .= " DEF:".$in."octets=$database:IN:AVERAGE";
|
||||
$options .= " DEF:".$out."octets_max=$database:OUT:MAX";
|
||||
$options .= " DEF:".$in."octets_max=$database:IN:MAX";
|
||||
} else {
|
||||
$options .= " DEF:".$out."octets=$database:OUTOCTETS:AVERAGE";
|
||||
$options .= " DEF:".$in."octets=$database:INOCTETS:AVERAGE";
|
||||
$options .= " DEF:".$out."octets_max=$database:OUTOCTETS:MAX";
|
||||
$options .= " DEF:".$in."octets_max=$database:INOCTETS:MAX";
|
||||
}
|
||||
|
||||
$options .= " CDEF:octets=inoctets,outoctets,+";
|
||||
$options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||
@@ -555,12 +857,11 @@ function graph_entity_sensor ($sensor, $graph , $from, $to, $width, $height, $ti
|
||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '$sensor' and D.device_id = E.device_id"));
|
||||
$database = $config['rrd_dir'] . "/" . $sensor['hostname'] . "/ces-" . $sensor['entPhysicalIndex'] . ".rrd";
|
||||
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
|
||||
if($height < "99") { $options .= " --only-graph -u 100 -l 0 -r "; unset ($legend); }
|
||||
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
|
||||
|
||||
$type = str_pad($sensor['entSensorType'], 8);
|
||||
$type = substr($type,0,8);
|
||||
|
||||
|
||||
$options .= " DEF:avg=$database:value:AVERAGE";
|
||||
$options .= " DEF:min=$database:value:MIN";
|
||||
$options .= " DEF:max=$database:value:MAX";
|
||||
@@ -692,7 +993,6 @@ function uptimegraph ($rrd, $graph , $from, $to, $width, $height, $title, $verti
|
||||
return $imgfile;
|
||||
}
|
||||
|
||||
|
||||
function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config, $installdir;
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rewrite_entSensorType = array (
|
||||
'celsius' => 'C',
|
||||
'unknown' => '',
|
||||
@@ -196,6 +197,19 @@ function fixifName ($inf)
|
||||
return $inf;
|
||||
}
|
||||
|
||||
function short_port_descr ($desc) {
|
||||
|
||||
list($desc) = explode("(", $desc);
|
||||
list($desc) = explode("[", $desc);
|
||||
list($desc) = explode("{", $desc);
|
||||
list($desc) = explode("|", $desc);
|
||||
list($desc) = explode("<", $desc);
|
||||
$desc = trim($desc);
|
||||
|
||||
return $desc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Underlying rewrite functions
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
$snmpver = $device['snmpver'];
|
||||
$port = $device['port'];
|
||||
|
||||
echo("$hostname\n");
|
||||
echo("$hostname ");
|
||||
|
||||
$status = shell_exec($config['fping'] . " $hostname | cut -d ' ' -f 3");
|
||||
$status = trim($status);
|
||||
@@ -34,6 +34,12 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
}
|
||||
|
||||
|
||||
if($status == '1') {
|
||||
echo("Up\n");
|
||||
} else {
|
||||
echo("Down\n");
|
||||
}
|
||||
|
||||
if($status != $device['status']) {
|
||||
|
||||
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
|
||||
|
||||
+10
-4
@@ -3,6 +3,11 @@
|
||||
|
||||
include("config.php");
|
||||
|
||||
if(!$config['enable_syslog']) {
|
||||
echo("Syslog support disabled.\n");
|
||||
exit();
|
||||
}
|
||||
|
||||
include("includes/syslog.php");
|
||||
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%last message repeated%'");
|
||||
@@ -12,10 +17,11 @@ mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%PM-3-
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%RHWatchdog%'");
|
||||
mysql_query("DELETE FROM `syslog` WHERE `processed` = '0' AND `msg` LIKE '%Hardware Monitoring%'");
|
||||
|
||||
if(!$config['enable_syslog']) {
|
||||
echo("Syslog support disabled.\n");
|
||||
exit();
|
||||
}
|
||||
#mysql_query("DELETE FROM `syslog` WHERE `program` LIKE 'SNMP-3-AUTHFAIL'");
|
||||
#mysql_query("DELETE FROM `syslog` WHERE `program` LIKE 'SW_MATM-4-MACFLAP_NOTIF'");
|
||||
|
||||
mysql_query("DELETE FROM `syslog` WHERE `priority` = 'debug'");
|
||||
|
||||
|
||||
## Delete all the old old old syslogs (as per config.php variable)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user