mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fixed check-errors and some other little issues. added EtherLik-MIB. cleaned up mac-accounting
git-svn-id: http://www.observium.org/svn/observer/trunk@482 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -8,13 +8,20 @@ include("includes/functions.php");
|
||||
|
||||
if($argv[1]) { $where = "AND `interface_id` = '$argv[1]'"; }
|
||||
|
||||
$i = '0';
|
||||
|
||||
$interface_query = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id $where");
|
||||
while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$errors = interface_errors($interface);
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd";
|
||||
$errors = interface_errors($rrdfile);
|
||||
mysql_query("UPDATE `interfaces` SET in_errors = '" . $errors['in'] . "', out_errors = '" . $errors['out'] . "' WHERE interface_id = '" . $interface['interface_id'] . "'");
|
||||
if($errors['in'] > '100' || $errors['out'] > '100') { $errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $errors['in'] . " - " . $errors['out']; }
|
||||
if($errors['in'] > '100' || $errors['out'] > '100') {
|
||||
$errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $errors['in'] . " - " . $errors['out'];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("Checked $i Interfaces\n");
|
||||
|
||||
if($errored) { ## If there are errored interfaces
|
||||
$i=0;
|
||||
@ -23,10 +30,8 @@ if($errored) { ## If there are errored interfaces
|
||||
$msg .= "$int\n"; ## Add a line to the report email warning about them
|
||||
$i++;
|
||||
}
|
||||
|
||||
## Send the alert email
|
||||
mail($config['email_default'], "Observer detected errors on $i interfaces", $msg, $config['email_headers']);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -22,8 +22,9 @@
|
||||
|
||||
if($_GET['optd'] == "top10") {
|
||||
if($_GET['opte']) {
|
||||
$from = "-" . $_GET['opte'];
|
||||
} else { $from = "-1day"; }
|
||||
$period = $_GET['opte'];
|
||||
} else { $period = "1day"; }
|
||||
$from = "-" . $period;
|
||||
if($_GET['optc']) {
|
||||
$stat = $_GET['optc'];
|
||||
} else { $stat = "bits"; }
|
||||
@ -60,13 +61,13 @@
|
||||
<div style=' margin:0px; float: left;';>
|
||||
<div style='margin: 0px 0px 20px 10px; padding:5px; background: #e5e5e5;'>
|
||||
<span class=device-head>Traffic</span><br />
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/top10/1day/'>
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/top10/$period/'>
|
||||
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=bits&type=mac_acc_total&from=$from&to=now&width=150&height=50' />
|
||||
</a>
|
||||
</div>
|
||||
<div style='margin: 0px 0px 20px 10px; padding:5px; background: #e5e5e5;'>
|
||||
<span class=device-head>Packets</span><br />
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/top10/1day/'>
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/top10/$period/'>
|
||||
<img style='border: #5e5e5e 2px;' valign=middle src='".$config['base_url']."/graph.php?port=".$interface['interface_id']."&stat=pkts&type=mac_acc_total&from=$from&to=now&width=150&height=50' />
|
||||
</a>
|
||||
</div>
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
<?php
|
||||
|
||||
echo("<table width=100%>");
|
||||
echo("<table width=100% cellspacing=0 cellpadding=2>");
|
||||
|
||||
if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
|
||||
if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; }
|
||||
@ -63,7 +63,7 @@ $sql = "SELECT * FROM `ipv4_addresses` AS A, `interfaces` AS I, `devices` AS D,
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<tr class=tablehead><th>Device</a></th><th>Interface</th><th>Address</th><th>Subnet</th><th>Description</th></tr>");
|
||||
echo("<tr class=tablehead><th>Device</a></th><th>Interface</th><th>Address</th><th>Description</th></tr>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
@ -75,13 +75,15 @@ while($interface = mysql_fetch_array($query)) {
|
||||
if (!match_network($addy . "/" . $mask, $interface['ipv4_address'] )) { $ignore = 1; }
|
||||
}
|
||||
|
||||
if(!$ignore) {
|
||||
if(!$ignore) {
|
||||
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$speed = humanspeed($interface['ifSpeed']);
|
||||
$type = humanmedia($interface['ifType']);
|
||||
|
||||
list($prefix, $length) = explode("/", $interface['ipv4_network']);
|
||||
|
||||
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 = ""; }
|
||||
@ -91,8 +93,7 @@ if(!$ignore) {
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generatedevicelink($interface) . "</td>
|
||||
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
|
||||
<td>" . $interface['ipv4_address'] . "</td>
|
||||
<td>" . $interface['ipv4_network'] . "</td>
|
||||
<td>" . $interface['ipv4_address'] . "/".$length."</td>
|
||||
<td>" . $interface['ifAlias'] . "</td>
|
||||
</tr>\n");
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
<?php
|
||||
|
||||
echo("<table width=100%>");
|
||||
echo("<table width=100% cellpadding=2 cellspacing=0>");
|
||||
|
||||
if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
|
||||
if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; }
|
||||
@ -63,7 +63,7 @@ $sql = "SELECT * FROM `ipv6_addresses` AS A, `interfaces` AS I, `devices` AS D,
|
||||
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<tr class=tablehead><th>Device</a></th><th>Interface</th><th>Address</th><th>Subnet</th><th>Description</th></tr>");
|
||||
echo("<tr class=tablehead><td width=0></td><th>Device</a></th><th>Interface</th><th>Address</th><th>Description</th></tr>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
@ -82,17 +82,18 @@ if(!$ignore) {
|
||||
$speed = humanspeed($interface['ifSpeed']);
|
||||
$type = humanmedia($interface['ifType']);
|
||||
|
||||
list($prefix, $length) = explode("/", $interface['ipv6_network']);
|
||||
|
||||
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 = ""; }
|
||||
|
||||
if( interfacepermitted($interface['interface_id']) )
|
||||
{
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
echo("<tr bgcolor=$row_colour><td></td>
|
||||
<td class=list-bold>" . generatedevicelink($interface) . "</td>
|
||||
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
|
||||
<td>" . Net_IPv6::compress($interface['ipv6_address']) . "</td>
|
||||
<td>" . $interface['ipv6_network'] . "</td>
|
||||
<td>" . Net_IPv6::compress($interface['ipv6_address']) . "/".$length."</td>
|
||||
<td>" . $interface['ifAlias'] . "</td>
|
||||
</tr>\n");
|
||||
|
||||
|
@ -54,12 +54,23 @@ echo("
|
||||
echo("</td><td>");
|
||||
$interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'");
|
||||
unset($seperator);
|
||||
|
||||
while($port = mysql_fetch_array($interfaces)) {
|
||||
if($_GET['opta']) {
|
||||
$graph_type = $_GET['opta'];
|
||||
include("includes/print-port-thumbs.inc.php");
|
||||
} else {
|
||||
$port = array_merge ($device, $port);
|
||||
if($_GET['opta']) {
|
||||
$port['width'] = "130";
|
||||
$port['height'] = "30";
|
||||
$port['from'] = $day;
|
||||
$port['to'] = $now;
|
||||
$port['bg'] = "#".$bg;
|
||||
$port['graph_type'] = $_GET['opta'];
|
||||
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;
|
||||
text-align: center; float: left; background-color: ".$list_colour_b_b.";'>
|
||||
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>");
|
||||
generate_port_thumbnail($port);
|
||||
echo("<div style='font-size: 9px;'>".truncate(short_port_descr($port['ifAlias']), 22, '')."</div>
|
||||
</div>");
|
||||
} else {
|
||||
echo($seperator.generateiflink($port,makeshortif($port['ifDescr'])));
|
||||
$seperator = ", ";
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ $translate_ifAdminStatus = array(
|
||||
|
||||
function translate_ifAdminStatus ($ifAdminStatus) {
|
||||
global $translate_ifAdminStatus;
|
||||
if($translate_ifAdminStatus['$ifAdminStatus']) {
|
||||
$ifAdminStatus = $translate_ifAdminStatus['$ifAdminStatus'];
|
||||
if($translate_ifAdminStatus[$ifAdminStatus]) {
|
||||
$ifAdminStatus = $translate_ifAdminStatus[$ifAdminStatus];
|
||||
}
|
||||
return $ifAdminStatus;
|
||||
}
|
||||
|
1137
mibs/EtherLike-MIB.txt
Normal file
1137
mibs/EtherLike-MIB.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user