mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more eventlog fixes
git-svn-id: http://www.observium.org/svn/observer/trunk@552 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 17 KiB |
@@ -39,6 +39,7 @@
|
||||
if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = 1; }
|
||||
}
|
||||
if ($nullintf == 0) {
|
||||
echo("$if\n");
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifDescr')");
|
||||
# Add Interface
|
||||
@@ -60,6 +61,7 @@
|
||||
# Delete Interface
|
||||
echo("-"); ## Deleted Interface
|
||||
} else {
|
||||
echo("$if\n");
|
||||
echo("X"); ## Ignored Interface
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +80,15 @@
|
||||
|
||||
/// Update IF-MIB data
|
||||
foreach ($data_oids as $oid) {
|
||||
if ( $port[$oid] != $this_port[$oid]) {
|
||||
if ( $port[$oid] != $this_port[$oid] && !isset($this_port[$oid])) {
|
||||
$update .= ", `$oid` = NULL";
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $device['device_id'] . "', '" . $port['interface_id'] . "', NOW(), '".$oid . ": ".$port[$oid]." -> NULL')");
|
||||
if($debug) { echo($oid . ": ".$port[$oid]." -> NULL "); } else { echo($oid . " "); }
|
||||
} elseif ( $port[$oid] != $this_port[$oid] ) {
|
||||
$update .= ", `$oid` = '".mysql_real_escape_string($this_port[$oid])."'";
|
||||
#mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $port['device_id'] . "', '" . $port['interface_id'] . "', NOW(), '".$oid . ": ".$port[$oid]." -> " . $this_port[$oid]."')");
|
||||
#eventlog($device['device_id'], 'interface', $port['interface_id'], $oid . ": ".$port[$oid]." -> " . $this_port[$oid]);
|
||||
mysql_query("INSERT INTO eventlog (`host`, `interface`, `datetime`, `message`) VALUES ('" . $device['device_id'] . "', '" . $port['interface_id'] . "', NOW(), '".$oid . ": ".$port[$oid]." -> " . $this_port[$oid]."')");
|
||||
echo($oid . " ");
|
||||
if($debug) { echo($oid . ": ".$port[$oid]." -> " . $this_port[$oid]." "); } else { echo($oid . " "); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,11 +162,13 @@
|
||||
/// Do EtherLike-MIB
|
||||
if($config['enable_etherlike']) { include("port-etherlike.inc.php"); }
|
||||
|
||||
if ($update) { /// Do Updates
|
||||
// Update MySQL
|
||||
if ($update) {
|
||||
$update_query = "UPDATE `interfaces` SET ".$update." WHERE `interface_id` = '" . $port['interface_id'] . "'";
|
||||
@mysql_query($update_query); $mysql++;
|
||||
if($debug) {echo("\nMYSQL : [ $update_query ]");}
|
||||
} /// End Updates
|
||||
}
|
||||
// End Update MySQL
|
||||
|
||||
unset($update_query); unset($update);
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,6 @@ while($loc_data = mysql_fetch_array($loc_result)) {
|
||||
if(strpos($host, "bgw")) { $hostinfo = "shape=ellipse style=filled fillcolor=orange"; }
|
||||
if(strpos($host, "vax")) { $hostinfo = "shape=rect style=filled fillcolor=skyblue"; }
|
||||
if(strpos($host, "vsx")) { $hostinfo = "shape=box3d style=filled fillcolor=skyblue"; }
|
||||
#} else { $hostinfo = "style=filled shape=circle fillcolor=lightgray"; }
|
||||
|
||||
$host = $dev_data[hostname];
|
||||
$host = str_replace("." . $config['mydomain'],"", $host);
|
||||
|
||||
Reference in New Issue
Block a user