2019-05-01 11:12:51 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* JnxDomLaneAlarmCleared.php
|
|
|
|
*
|
|
|
|
* -Description-
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-02-09 00:29:04 +01:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-05-01 11:12:51 -05:00
|
|
|
*
|
|
|
|
* Trap sent when a Juniper transciever lambda reaches an alert level threshold.
|
|
|
|
*
|
2021-02-09 00:29:04 +01:00
|
|
|
* @link https://www.librenms.org
|
2021-09-10 20:09:53 +02:00
|
|
|
*
|
2019-05-01 11:12:51 -05:00
|
|
|
* @copyright 2018 KanREN, Inc.
|
|
|
|
* @author Heath Barnhart <hbarnhart@kanren.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace LibreNMS\Snmptrap\Handlers;
|
|
|
|
|
|
|
|
use App\Models\Device;
|
2023-08-05 12:12:36 -05:00
|
|
|
use LibreNMS\Enum\Severity;
|
2019-05-01 11:12:51 -05:00
|
|
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
|
|
|
use LibreNMS\Snmptrap\Trap;
|
|
|
|
use Log;
|
|
|
|
|
|
|
|
class JnxDomLaneAlarmCleared implements SnmptrapHandler
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle snmptrap.
|
|
|
|
* Data is pre-parsed and delivered as a Trap.
|
|
|
|
*
|
2021-09-08 23:35:56 +02:00
|
|
|
* @param Device $device
|
|
|
|
* @param Trap $trap
|
2019-05-01 11:12:51 -05:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function handle(Device $device, Trap $trap)
|
|
|
|
{
|
|
|
|
$currentAlarm = $trap->getOidData($trap->findOid('JUNIPER-DOM-MIB::jnxDomCurrentLaneAlarms'));
|
|
|
|
$lane = $trap->getOidData($trap->findOid('JUNIPER-DOM-MIB::jnxDomLaneIndex'));
|
|
|
|
$alarmList = JnxDomLaneAlarmId::getLaneAlarms($currentAlarm);
|
|
|
|
|
|
|
|
$ifIndex = substr(strrchr($trap->findOid('IF-MIB::ifDescr'), '.'), 1);
|
|
|
|
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
|
|
|
if (! $port) {
|
2021-03-30 00:43:05 +02:00
|
|
|
Log::warning("Snmptrap JnxDomLaneAlarmCleared: Could not find port at ifIndex $ifIndex for device: " . $device->hostname);
|
2020-09-21 14:54:51 +02:00
|
|
|
|
2019-05-01 11:12:51 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-08-05 12:12:36 -05:00
|
|
|
$trap->log("DOM lane alarm cleared on interface $port->ifDescr lane $lane. Current alarm(s): $alarmList", Severity::Ok);
|
2019-05-01 11:12:51 -05:00
|
|
|
}
|
|
|
|
}
|