2010-02-17 11:02:18 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-28 12:32:58 -05:00
|
|
|
$interface = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'],$entry[2]));
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if (!$interface) {
|
|
|
|
exit;
|
|
|
|
}
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-03-15 15:41:57 +00:00
|
|
|
$ifOperStatus = "up";
|
|
|
|
$ifAdminStatus = "up";
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2012-05-16 13:25:50 +00:00
|
|
|
log_event("SNMP Trap: linkUp $ifAdminStatus/$ifOperStatus " . $interface['ifDescr'], $device, "interface", $interface['port_id']);
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($ifAdminStatus != $interface['ifAdminStatus']) {
|
2016-08-28 12:32:58 -05:00
|
|
|
log_event("Interface Enabled : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['port_id']);
|
|
|
|
dbUpdate(array('ifAdminStatus' => 'up'), 'ports', 'port_id=?', array($interface['port_id']));
|
2011-03-15 15:41:57 +00:00
|
|
|
}
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($ifOperStatus != $interface['ifOperStatus']) {
|
2016-08-28 12:32:58 -05:00
|
|
|
log_event("Interface went Up : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['port_id']);
|
|
|
|
dbUpdate(array('ifOperStatus' => 'up'), 'ports', 'port_id=?', array($interface['port_id']));
|
2011-03-15 15:41:57 +00:00
|
|
|
}
|