librenms/includes/snmptrap/linkDown.inc.php
Richard Mayhew 5bfd23e7eb webui: New eventlog severity classification (#5830)
* New event log severity model

* Revert "New event log severity model"

This reverts commit 0783527af8.

* New event log severity model

* Fixed spaces vs tabs

* Learning the format requirements

* Learning the format requirements

* Moved the colours in to the stylesheet

* change SQL file to stop conflicting

* refactor log_event so severity isn't last, but reference is.

* keep having to move the file due to new PR conflicts

* Revert "keep having to move the file due to new PR conflicts"

This reverts commit f3030e7218.

* extended support to dashboard and eventlog page

* formatting
2017-02-12 22:41:05 +00:00

21 lines
791 B
PHP

<?php
$interface = dbFetchRow('SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $entry[2]));
if (!$interface) {
exit;
}
$ifOperStatus = 'down';
// $ifAdminStatus = "down";
log_event('SNMP Trap: linkDown ' . $interface['ifDescr'], $device, 'interface', 5, $interface['port_id']);
// if ($ifAdminStatus != $interface['ifAdminStatus'])
// {
// log_event("Interface Disabled : " . $interface['ifDescr'] . " (TRAP)", $device, "interface", $interface['port_id']);
// }
if ($ifOperStatus != $interface['ifOperStatus']) {
log_event('Interface went Down : ' . $interface['ifDescr'] . ' (TRAP)', $device, 'interface', 5, $interface['port_id']);
dbUpdate(array('ifOperStatus' => 'down'), 'ports', 'port_id=?', array($interface['port_id']));
}