mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix some errors, make the interfaces errors script a little better
git-svn-id: http://www.observium.org/svn/observer/trunk@168 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -4,25 +4,27 @@
|
||||
include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
## Check all of our interface RRD files for errors
|
||||
|
||||
if($argv[1]) { $where = "AND `interface_id` = '$argv[1]'"; }
|
||||
|
||||
$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);
|
||||
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['ifAlias'] . " - " . $errors['in'] . " - " . $errors['out']; }
|
||||
|
||||
if($errors['in'] > '100' || $errors['out'] > '100') { $errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $errors['in'] . " - " . $errors['out']; }
|
||||
}
|
||||
|
||||
if($errored) {
|
||||
|
||||
if($errored) { ## If there are errored interfaces
|
||||
$i=0;
|
||||
$msg = "Interfaces with errors : \n\n";
|
||||
foreach ($errored as $int) {
|
||||
$msg .= "$int\n";
|
||||
$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']);
|
||||
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
|
||||
<table width='200' border='0'>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Description</div></td>
|
||||
<td colspan='3'><input name='descr' width='50'>$descr</textarea></td>
|
||||
<td colspan='3'><input name='descr' width='50'>$descr</input></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
Reference in New Issue
Block a user