mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 02:18:39 +00:00
Severity Enum (#14620)
* Severity Enum Replace old Alert constants * Fix whitespace * Additional uses * style fixes * Fix test too * More missed locations * More
This commit is contained in:
parent
9382959c8c
commit
d1b7004fef
@ -34,8 +34,8 @@ use App\Facades\DeviceCache;
|
|||||||
use App\Models\AlertTransport;
|
use App\Models\AlertTransport;
|
||||||
use App\Models\Eventlog;
|
use App\Models\Eventlog;
|
||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\Enum\Alert;
|
|
||||||
use LibreNMS\Enum\AlertState;
|
use LibreNMS\Enum\AlertState;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Exceptions\AlertTransportDeliveryException;
|
use LibreNMS\Exceptions\AlertTransportDeliveryException;
|
||||||
use LibreNMS\Polling\ConnectivityHelper;
|
use LibreNMS\Polling\ConnectivityHelper;
|
||||||
use LibreNMS\Util\Time;
|
use LibreNMS\Util\Time;
|
||||||
@ -449,7 +449,7 @@ class RunAlerts
|
|||||||
|
|
||||||
if ($this->isParentDown($alert['device_id'])) {
|
if ($this->isParentDown($alert['device_id'])) {
|
||||||
$noiss = true;
|
$noiss = true;
|
||||||
Eventlog::log('Skipped alerts because all parent devices are down', $alert['device_id'], 'alert', 1);
|
Eventlog::log('Skipped alerts because all parent devices are down', $alert['device_id'], 'alert', Severity::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($alert['state'] == AlertState::RECOVERED && $rextra['recovery'] == false) {
|
if ($alert['state'] == AlertState::RECOVERED && $rextra['recovery'] == false) {
|
||||||
@ -511,7 +511,7 @@ class RunAlerts
|
|||||||
$tmp = $instance->deliverAlert($obj, $item['opts'] ?? []);
|
$tmp = $instance->deliverAlert($obj, $item['opts'] ?? []);
|
||||||
$this->alertLog($tmp, $obj, $obj['transport']);
|
$this->alertLog($tmp, $obj, $obj['transport']);
|
||||||
} catch (AlertTransportDeliveryException $e) {
|
} catch (AlertTransportDeliveryException $e) {
|
||||||
Eventlog::log($e->getMessage(), $obj['device_id'], 'alert', Alert::ERROR);
|
Eventlog::log($e->getMessage(), $obj['device_id'], 'alert', Severity::Error);
|
||||||
$this->alertLog($e->getMessage(), $obj, $obj['transport']);
|
$this->alertLog($e->getMessage(), $obj, $obj['transport']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->alertLog($e, $obj, $obj['transport']);
|
$this->alertLog($e, $obj, $obj['transport']);
|
||||||
@ -537,25 +537,22 @@ class RunAlerts
|
|||||||
AlertState::BETTER => 'got better',
|
AlertState::BETTER => 'got better',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($obj['state'] == AlertState::RECOVERED) {
|
$severity = match ($obj['state']) {
|
||||||
$severity = Alert::OK;
|
AlertState::RECOVERED => Severity::Ok,
|
||||||
} elseif ($obj['state'] == AlertState::ACTIVE) {
|
AlertState::ACTIVE => Severity::tryFrom((int) $obj['severity']) ?? Severity::Unknown,
|
||||||
$severity = Alert::SEVERITIES[$obj['severity']] ?? Alert::UNKNOWN;
|
AlertState::ACKNOWLEDGED => Severity::Notice,
|
||||||
} elseif ($obj['state'] == AlertState::ACKNOWLEDGED) {
|
default => Severity::Unknown,
|
||||||
$severity = Alert::NOTICE;
|
};
|
||||||
} else {
|
|
||||||
$severity = Alert::UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result === true) {
|
if ($result === true) {
|
||||||
echo 'OK';
|
echo 'OK';
|
||||||
Eventlog::log('Issued ' . $prefix[$obj['state']] . " for rule '" . $obj['name'] . "' to transport '" . $transport . "'", $obj['device_id'], 'alert', $severity);
|
Eventlog::log('Issued ' . $prefix[$obj['state']] . " for rule '" . $obj['name'] . "' to transport '" . $transport . "'", $obj['device_id'], 'alert', $severity);
|
||||||
} elseif ($result === false) {
|
} elseif ($result === false) {
|
||||||
echo 'ERROR';
|
echo 'ERROR';
|
||||||
Eventlog::log('Could not issue ' . $prefix[$obj['state']] . " for rule '" . $obj['name'] . "' to transport '" . $transport . "'", $obj['device_id'], null, Alert::ERROR);
|
Eventlog::log('Could not issue ' . $prefix[$obj['state']] . " for rule '" . $obj['name'] . "' to transport '" . $transport . "'", $obj['device_id'], null, Severity::Error);
|
||||||
} else {
|
} else {
|
||||||
echo "ERROR: $result\r\n";
|
echo "ERROR: $result\r\n";
|
||||||
Eventlog::log('Could not issue ' . $prefix[$obj['state']] . " for rule '" . $obj['name'] . "' to transport '" . $transport . "' Error: " . $result, $obj['device_id'], 'error', Alert::ERROR);
|
Eventlog::log('Could not issue ' . $prefix[$obj['state']] . " for rule '" . $obj['name'] . "' to transport '" . $transport . "' Error: " . $result, $obj['device_id'], 'error', Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ use App\Models\ComponentPref;
|
|||||||
use App\Models\ComponentStatusLog;
|
use App\Models\ComponentStatusLog;
|
||||||
use App\Models\Eventlog;
|
use App\Models\Eventlog;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
class Component
|
class Component
|
||||||
@ -242,7 +243,7 @@ class Component
|
|||||||
}
|
}
|
||||||
$component->save();
|
$component->save();
|
||||||
|
|
||||||
Eventlog::log($message, $component->device_id, 'component', 3, $component->id);
|
Eventlog::log($message, $component->device_id, 'component', Severity::Notice, $component->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update preferences
|
// update preferences
|
||||||
@ -258,18 +259,18 @@ class Component
|
|||||||
$invalid->forget($existing->id);
|
$invalid->forget($existing->id);
|
||||||
$existing->fill(['value' => $value]);
|
$existing->fill(['value' => $value]);
|
||||||
if ($existing->isDirty()) {
|
if ($existing->isDirty()) {
|
||||||
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', 3, $component->id);
|
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', Severity::Notice, $component->id);
|
||||||
$existing->save();
|
$existing->save();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$component->prefs()->save(new ComponentPref(['attribute' => $attribute, 'value' => $value]));
|
$component->prefs()->save(new ComponentPref(['attribute' => $attribute, 'value' => $value]));
|
||||||
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was added with value: $value", $component->device_id, 'component', 3, $component->id);
|
Eventlog::log("Component: $component->type($component->id). Attribute: $attribute, was added with value: $value", $component->device_id, 'component', Severity::Notice, $component->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($invalid as $pref) {
|
foreach ($invalid as $pref) {
|
||||||
$pref->delete();
|
$pref->delete();
|
||||||
Eventlog::log("Component: $component->type($component->id). Attribute: $pref->attribute, was deleted.", $component->device_id, 'component', 4);
|
Eventlog::log("Component: $component->type($component->id). Attribute: $pref->attribute, was deleted.", $component->device_id, 'component', Severity::Warning);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ use DeviceCache;
|
|||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\Enum\Alert;
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Util\Debug;
|
use LibreNMS\Util\Debug;
|
||||||
use LibreNMS\Util\Oid;
|
use LibreNMS\Util\Oid;
|
||||||
use LibreNMS\Util\Rewrite;
|
use LibreNMS\Util\Rewrite;
|
||||||
@ -467,9 +467,9 @@ class NetSnmpQuery implements SnmpQueryInterface
|
|||||||
{
|
{
|
||||||
if ($code) {
|
if ($code) {
|
||||||
if (Str::startsWith($error, 'Invalid authentication protocol specified')) {
|
if (Str::startsWith($error, 'Invalid authentication protocol specified')) {
|
||||||
Eventlog::log('Unsupported SNMP authentication algorithm - ' . $code, $this->device, 'poller', Alert::ERROR);
|
Eventlog::log('Unsupported SNMP authentication algorithm - ' . $code, $this->device, 'poller', Severity::Error);
|
||||||
} elseif (Str::startsWith($error, 'Invalid privacy protocol specified')) {
|
} elseif (Str::startsWith($error, 'Invalid privacy protocol specified')) {
|
||||||
Eventlog::log('Unsupported SNMP privacy algorithm - ' . $code, $this->device, 'poller', Alert::ERROR);
|
Eventlog::log('Unsupported SNMP privacy algorithm - ' . $code, $this->device, 'poller', Severity::Error);
|
||||||
}
|
}
|
||||||
Log::debug('Exitcode: ' . $code, [$error]);
|
Log::debug('Exitcode: ' . $code, [$error]);
|
||||||
}
|
}
|
||||||
|
13
LibreNMS/Enum/Severity.php
Normal file
13
LibreNMS/Enum/Severity.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace LibreNMS\Enum;
|
||||||
|
|
||||||
|
enum Severity: int
|
||||||
|
{
|
||||||
|
case Unknown = 0;
|
||||||
|
case Ok = 1;
|
||||||
|
case Info = 2;
|
||||||
|
case Notice = 3;
|
||||||
|
case Warning = 4;
|
||||||
|
case Error = 5;
|
||||||
|
}
|
@ -29,6 +29,7 @@ use App\Models\Device;
|
|||||||
use App\Models\Eventlog;
|
use App\Models\Eventlog;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\Module;
|
use LibreNMS\Interfaces\Module;
|
||||||
use LibreNMS\OS;
|
use LibreNMS\OS;
|
||||||
use LibreNMS\RRD\RrdDefinition;
|
use LibreNMS\RRD\RrdDefinition;
|
||||||
@ -61,7 +62,7 @@ class Core implements Module
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($device->getDirty() as $attribute => $value) {
|
foreach ($device->getDirty() as $attribute => $value) {
|
||||||
Eventlog::log($value . ' -> ' . $device->$attribute, $device, 'system', 3);
|
Eventlog::log($value . ' -> ' . $device->$attribute, $device, 'system', Severity::Notice);
|
||||||
$os->getDeviceArray()[$attribute] = $value; // update device array
|
$os->getDeviceArray()[$attribute] = $value; // update device array
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ class Core implements Module
|
|||||||
$device->os = self::detectOS($device, false);
|
$device->os = self::detectOS($device, false);
|
||||||
|
|
||||||
if ($device->isDirty('os')) {
|
if ($device->isDirty('os')) {
|
||||||
Eventlog::log('Device OS changed: ' . $device->getOriginal('os') . ' -> ' . $device->os, $device, 'system', 3);
|
Eventlog::log('Device OS changed: ' . $device->getOriginal('os') . ' -> ' . $device->os, $device, 'system', Severity::Notice);
|
||||||
$os->getDeviceArray()['os'] = $device->os;
|
$os->getDeviceArray()['os'] = $device->os;
|
||||||
|
|
||||||
echo 'Changed ';
|
echo 'Changed ';
|
||||||
@ -272,7 +273,7 @@ class Core implements Module
|
|||||||
// set it if unless it is wrong
|
// set it if unless it is wrong
|
||||||
if ($uptime > 0) {
|
if ($uptime > 0) {
|
||||||
if ($uptime < $device->uptime) {
|
if ($uptime < $device->uptime) {
|
||||||
Eventlog::log('Device rebooted after ' . Time::formatInterval($device->uptime) . " -> {$uptime}s", $device, 'reboot', 4, $device->uptime);
|
Eventlog::log('Device rebooted after ' . Time::formatInterval($device->uptime) . " -> {$uptime}s", $device, 'reboot', Severity::Warning, $device->uptime);
|
||||||
if (Config::get('discovery_on_reboot')) {
|
if (Config::get('discovery_on_reboot')) {
|
||||||
$device->last_discovered = null;
|
$device->last_discovered = null;
|
||||||
$device->save();
|
$device->save();
|
||||||
|
@ -27,7 +27,7 @@ use App\Observers\ModuleModelObserver;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\DB\SyncsModels;
|
use LibreNMS\DB\SyncsModels;
|
||||||
use LibreNMS\Enum\Alert;
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\Module;
|
use LibreNMS\Interfaces\Module;
|
||||||
use LibreNMS\OS;
|
use LibreNMS\OS;
|
||||||
use LibreNMS\RRD\RrdDefinition;
|
use LibreNMS\RRD\RrdDefinition;
|
||||||
@ -98,7 +98,7 @@ class PrinterSupplies implements Module
|
|||||||
'Toner ' . $toner['supply_descr'] . ' is empty',
|
'Toner ' . $toner['supply_descr'] . ' is empty',
|
||||||
$os->getDevice(),
|
$os->getDevice(),
|
||||||
'toner',
|
'toner',
|
||||||
Alert::ERROR,
|
Severity::Error,
|
||||||
$toner['supply_id']
|
$toner['supply_id']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ class PrinterSupplies implements Module
|
|||||||
'Toner ' . $toner['supply_descr'] . ' was replaced (new level: ' . $tonerperc . '%)',
|
'Toner ' . $toner['supply_descr'] . ' was replaced (new level: ' . $tonerperc . '%)',
|
||||||
$os->getDevice(),
|
$os->getDevice(),
|
||||||
'toner',
|
'toner',
|
||||||
Alert::NOTICE,
|
Severity::Notice,
|
||||||
$toner['supply_id']
|
$toner['supply_id']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ namespace LibreNMS\OS;
|
|||||||
use App\Models\Eventlog;
|
use App\Models\Eventlog;
|
||||||
use App\Models\TnmsneInfo;
|
use App\Models\TnmsneInfo;
|
||||||
use App\Observers\ModuleModelObserver;
|
use App\Observers\ModuleModelObserver;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\Polling\OSPolling;
|
use LibreNMS\Interfaces\Polling\OSPolling;
|
||||||
|
|
||||||
class Coriant extends \LibreNMS\OS implements OSPolling
|
class Coriant extends \LibreNMS\OS implements OSPolling
|
||||||
@ -58,7 +59,7 @@ class Coriant extends \LibreNMS\OS implements OSPolling
|
|||||||
|
|
||||||
if ($ne->isDirty()) {
|
if ($ne->isDirty()) {
|
||||||
$ne->save();
|
$ne->save();
|
||||||
Eventlog::log("Coriant enmsNETable Hardware $ne->neType : $ne->neName ($index) at $ne->neLocation Discovered", $this->getDevice(), 'system', 2);
|
Eventlog::log("Coriant enmsNETable Hardware $ne->neType : $ne->neName ($index) at $ne->neLocation Discovered", $this->getDevice(), 'system');
|
||||||
}
|
}
|
||||||
$c_list[] = $index;
|
$c_list[] = $index;
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ class Coriant extends \LibreNMS\OS implements OSPolling
|
|||||||
foreach (TnmsneInfo::where('device_id', $this->getDeviceId())->whereNotIn('neID', $c_list)->get() as $ne) {
|
foreach (TnmsneInfo::where('device_id', $this->getDeviceId())->whereNotIn('neID', $c_list)->get() as $ne) {
|
||||||
/** @var TnmsneInfo $ne */
|
/** @var TnmsneInfo $ne */
|
||||||
$ne->delete();
|
$ne->delete();
|
||||||
Eventlog::log("Coriant enmsNETable Hardware $ne->neName at $ne->neLocation Removed", $this->getDevice(), 'system', $ne->neID);
|
Eventlog::log("Coriant enmsNETable Hardware $ne->neName at $ne->neLocation Removed", $this->getDevice(), 'system', Severity::Info, $ne->neID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ use Carbon\Carbon;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LibreNMS\Enum\Alert;
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Exceptions\PollerException;
|
use LibreNMS\Exceptions\PollerException;
|
||||||
use LibreNMS\Polling\ConnectivityHelper;
|
use LibreNMS\Polling\ConnectivityHelper;
|
||||||
use LibreNMS\RRD\RrdDefinition;
|
use LibreNMS\RRD\RrdDefinition;
|
||||||
@ -146,7 +146,7 @@ class Poller
|
|||||||
// check if the poll took too long and log an event
|
// check if the poll took too long and log an event
|
||||||
if ($measurement->getDuration() > Config::get('rrd.step')) {
|
if ($measurement->getDuration() > Config::get('rrd.step')) {
|
||||||
\App\Models\Eventlog::log('Polling took longer than ' . round(Config::get('rrd.step') / 60, 2) .
|
\App\Models\Eventlog::log('Polling took longer than ' . round(Config::get('rrd.step') / 60, 2) .
|
||||||
' minutes! This will cause gaps in graphs.', $this->device, 'system', 5);
|
' minutes! This will cause gaps in graphs.', $this->device, 'system', Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ class Poller
|
|||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
// isolate module exceptions so they don't disrupt the polling process
|
// isolate module exceptions so they don't disrupt the polling process
|
||||||
$this->logger->error("%rError polling $module module for {$this->device->hostname}.%n $e", ['color' => true]);
|
$this->logger->error("%rError polling $module module for {$this->device->hostname}.%n $e", ['color' => true]);
|
||||||
\App\Models\Eventlog::log("Error polling $module module. Check log file for more details.", $this->device, 'poller', Alert::ERROR);
|
\App\Models\Eventlog::log("Error polling $module module. Check log file for more details.", $this->device, 'poller', Severity::Error);
|
||||||
report($e);
|
report($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ use App\Models\Eventlog;
|
|||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
use LibreNMS\Data\Source\Fping;
|
use LibreNMS\Data\Source\Fping;
|
||||||
use LibreNMS\Data\Source\FpingResponse;
|
use LibreNMS\Data\Source\FpingResponse;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\RRD\RrdDefinition;
|
use LibreNMS\RRD\RrdDefinition;
|
||||||
use SnmpQuery;
|
use SnmpQuery;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
@ -124,7 +125,7 @@ class ConnectivityHelper
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($status->duplicates > 0) {
|
if ($status->duplicates > 0) {
|
||||||
Eventlog::log('Duplicate ICMP response detected! This could indicate a network issue.', $this->device, 'icmp', 4);
|
Eventlog::log('Duplicate ICMP response detected! This could indicate a network issue.', $this->device, 'icmp', Severity::Warning);
|
||||||
$status->exit_code = 0; // when duplicate is detected fping returns 1. The device is up, but there is another issue. Clue admins in with above event.
|
$status->exit_code = 0; // when duplicate is detected fping returns 1. The device is up, but there is another issue. Clue admins in with above event.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -45,23 +46,13 @@ class AdvaNetworkElementAlmTrap implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$alSeverity = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmNetworkElementAlmNotifCode'));
|
$alSeverity = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmNetworkElementAlmNotifCode'));
|
||||||
switch ($alSeverity) {
|
$logSeverity = match ($alSeverity) {
|
||||||
case 'critical':
|
'critical' => Severity::Error,
|
||||||
$logSeverity = 5;
|
'major' => Severity::Warning,
|
||||||
break;
|
'minor' => Severity::Notice,
|
||||||
case 'major':
|
'cleared' => Severity::Ok,
|
||||||
$logSeverity = 4;
|
default => Severity::Info,
|
||||||
break;
|
};
|
||||||
case 'minor':
|
|
||||||
$logSeverity = 3;
|
|
||||||
break;
|
|
||||||
case 'cleared':
|
|
||||||
$logSeverity = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$logSeverity = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$almDescr = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmNetworkElementAlmDescr'));
|
$almDescr = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmNetworkElementAlmDescr'));
|
||||||
$almObjName = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmNetworkElementAlmObjectName'));
|
$almObjName = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmNetworkElementAlmObjectName'));
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class AdvaSnmpDyingGaspTrap implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('Dying Gasp received', 5);
|
$trap->log('Dying Gasp received', Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -45,23 +46,13 @@ class AdvaSysAlmTrap implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$alSeverity = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmSysAlmNotifCode'));
|
$alSeverity = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmSysAlmNotifCode'));
|
||||||
switch ($alSeverity) {
|
$logSeverity = match ($alSeverity) {
|
||||||
case 'critical':
|
'critical' => Severity::Error,
|
||||||
$logSeverity = 5;
|
'major' => Severity::Warning,
|
||||||
break;
|
'minor' => Severity::Notice,
|
||||||
case 'major':
|
'cleared' => Severity::Ok,
|
||||||
$logSeverity = 4;
|
default => Severity::Info,
|
||||||
break;
|
};
|
||||||
case 'minor':
|
|
||||||
$logSeverity = 3;
|
|
||||||
break;
|
|
||||||
case 'cleared':
|
|
||||||
$logSeverity = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$logSeverity = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sysAlmDescr = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmSysAlmDescr'));
|
$sysAlmDescr = $trap->getOidData($trap->findOid('CM-ALARM-MIB::cmSysAlmDescr'));
|
||||||
$trap->log("System Alarm: $sysAlmDescr Status: $alSeverity", $logSeverity);
|
$trap->log("System Alarm: $sysAlmDescr Status: $alSeverity", $logSeverity);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ class Aos6LbdStateChangeForAutoRecovery implements SnmptrapHandler
|
|||||||
$current = $trap->getOidData($trap->findOid('ALCATEL-IND1-LBD-MIB::alaLbdCurrentStateAutoRecovery'));
|
$current = $trap->getOidData($trap->findOid('ALCATEL-IND1-LBD-MIB::alaLbdCurrentStateAutoRecovery'));
|
||||||
$ifIndex = $trap->getOidData($trap->findOid('ALCATEL-IND1-LBD-MIB::alaLbdPortIfIndex'));
|
$ifIndex = $trap->getOidData($trap->findOid('ALCATEL-IND1-LBD-MIB::alaLbdPortIfIndex'));
|
||||||
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
||||||
$trap->log("Loopback detection has been recovered on the port $port->ifDescr. Status of the port before was $before and now is $current.", 1);
|
$trap->log("Loopback detection has been recovered on the port $port->ifDescr. Status of the port before was $before and now is $current.", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -51,6 +52,6 @@ class Aos6LbdStateChangeToShutdown implements SnmptrapHandler
|
|||||||
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
||||||
$ifIndex = $trap->getOidData($trap->findOid('ALCATEL-IND1-LBD-MIB::alaLbdPortIfIndex'));
|
$ifIndex = $trap->getOidData($trap->findOid('ALCATEL-IND1-LBD-MIB::alaLbdPortIfIndex'));
|
||||||
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
||||||
$trap->log("There has been a loop detected on the port $port->ifDescr. Status of the port before was $before and now is $current.", 5);
|
$trap->log("There has been a loop detected on the port $port->ifDescr. Status of the port before was $before and now is $current.", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -47,6 +48,6 @@ class Aos6StackMgrDuplicateSlot implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$slot_nr = $trap->getOidData($trap->findOid('ALCATEL-IND1-STACK-MANAGER-MIB::alaStackMgrSlotNINumber'));
|
$slot_nr = $trap->getOidData($trap->findOid('ALCATEL-IND1-STACK-MANAGER-MIB::alaStackMgrSlotNINumber'));
|
||||||
$trap->log("Stack member $slot_nr is duplicated.", 5);
|
$trap->log("Stack member $slot_nr is duplicated.", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -51,6 +52,6 @@ class Aos7portViolation implements SnmptrapHandler
|
|||||||
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
||||||
$ifIndex = $trap->getOidData($trap->findOid('IF-MIB::ifIndex'));
|
$ifIndex = $trap->getOidData($trap->findOid('IF-MIB::ifIndex'));
|
||||||
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
||||||
$trap->log("There has been a loop detected on the port $port->ifDescr. The source code of the violation is: $reason and the current status code is: $current.", 5);
|
$trap->log("There has been a loop detected on the port $port->ifDescr. The source code of the violation is: $reason and the current status code is: $current.", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ class Aos7portViolationNotification implements SnmptrapHandler
|
|||||||
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
||||||
$ifIndex = $trap->getOidData($trap->findOid('IF-MIB::ifIndex'));
|
$ifIndex = $trap->getOidData($trap->findOid('IF-MIB::ifIndex'));
|
||||||
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
$port = $device->ports()->where('ifIndex', $ifIndex)->first();
|
||||||
$trap->log("There has been a loop detected on the port $port->ifDescr. The current status code is: $reason.", 5);
|
$trap->log("There has been a loop detected on the port $port->ifDescr. The current status code is: $reason.", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -41,6 +42,6 @@ class Aos7stpNewRoot implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Device ' . $device->displayName() . ' was elected as new root on one of its Spanning Tree Instances', 3, 'stp');
|
$trap->log('SNMP Trap: Device ' . $device->displayName() . ' was elected as new root on one of its Spanning Tree Instances', Severity::Notice, 'stp');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -41,6 +42,6 @@ class Aos7stpRootPortChange implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: A root port has changed for a spanning tree bridge. The root port is the port that offers the lowest cost path from this bridge to the root bridge.', 3, 'stp');
|
$trap->log('SNMP Trap: A root port has changed for a spanning tree bridge. The root port is the port that offers the lowest cost path from this bridge to the root bridge.', Severity::Notice, 'stp');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -43,6 +44,6 @@ class ApcOnBattery implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
||||||
$trap->log($message, 4);
|
$trap->log($message, Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ class ApcPduNearOverload implements SnmptrapHandler
|
|||||||
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
||||||
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
||||||
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
||||||
$trap->log("$pdu_id phase $phase_num $alarm_str", 4);
|
$trap->log("$pdu_id phase $phase_num $alarm_str", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ class ApcPduNearOverloadCleared implements SnmptrapHandler
|
|||||||
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
||||||
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
||||||
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
||||||
$trap->log("$pdu_id phase $phase_num $alarm_str", 1);
|
$trap->log("$pdu_id phase $phase_num $alarm_str", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -39,6 +40,6 @@ class ApcPduOutletOff implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$outlet = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsInteger.0'));
|
$outlet = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsInteger.0'));
|
||||||
$trap->log("APC PDU: Outlet has turned off: $outlet", 4);
|
$trap->log("APC PDU: Outlet has turned off: $outlet", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -39,6 +40,6 @@ class ApcPduOutletOn implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$outlet = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsInteger.0'));
|
$outlet = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsInteger.0'));
|
||||||
$trap->log("APC PDU: Outlet has been turned on: $outlet", 4);
|
$trap->log("APC PDU: Outlet has been turned on: $outlet", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -39,6 +40,6 @@ class ApcPduOutletReboot implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$outlet = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsInteger.0'));
|
$outlet = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsInteger.0'));
|
||||||
$trap->log("APC PDU: Outlet has rebooted: $outlet", 4);
|
$trap->log("APC PDU: Outlet has rebooted: $outlet", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ class ApcPduOverload implements SnmptrapHandler
|
|||||||
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
||||||
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
||||||
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
||||||
$trap->log("$pdu_id phase $phase_num $alarm_str", 5);
|
$trap->log("$pdu_id phase $phase_num $alarm_str", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ class ApcPduOverloadCleared implements SnmptrapHandler
|
|||||||
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
$pdu_id = ApcTrapUtil::getPduIdentName($trap);
|
||||||
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
$phase_num = ApcTrapUtil::getPduPhaseNum($trap);
|
||||||
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
$alarm_str = ApcTrapUtil::getApcTrapString($trap);
|
||||||
$trap->log("$pdu_id phase $phase_num $alarm_str", 1);
|
$trap->log("$pdu_id phase $phase_num $alarm_str", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -43,6 +44,6 @@ class ApcPowerRestored implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
||||||
$trap->log($message, 1);
|
$trap->log($message, Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -43,6 +44,6 @@ class ApcSmartAvrReducing implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
||||||
$trap->log($message, 3);
|
$trap->log($message, Severity::Notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -43,6 +44,6 @@ class ApcSmartAvrReducingOff implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
$message = $trap->getOidData($trap->findOid('PowerNet-MIB::mtrapargsString'));
|
||||||
$trap->log($message, 1);
|
$trap->log($message, Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -41,6 +42,6 @@ class AuthenticationFailure implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Authentication Failure: ' . $device->displayName(), 3, 'auth');
|
$trap->log('SNMP Trap: Authentication Failure: ' . $device->displayName(), Severity::Notice, 'auth');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -56,7 +57,8 @@ class BgpBackwardTransition implements SnmptrapHandler
|
|||||||
$bgpPeer->bgpPeerState = $trap->getOidData($state_oid);
|
$bgpPeer->bgpPeerState = $trap->getOidData($state_oid);
|
||||||
|
|
||||||
if ($bgpPeer->isDirty('bgpPeerState')) {
|
if ($bgpPeer->isDirty('bgpPeerState')) {
|
||||||
$trap->log('SNMP Trap: BGP Down ' . $bgpPeer->bgpPeerIdentifier . ' ' . get_astext($bgpPeer->bgpPeerRemoteAs) . ' is now ' . $bgpPeer->bgpPeerState, 5, 'bgpPeer', $bgpPeerIp);
|
$trap->log('SNMP Trap: BGP Down ' . $bgpPeer->bgpPeerIdentifier . ' ' . get_astext($bgpPeer->bgpPeerRemoteAs) . ' is now ' . $bgpPeer->bgpPeerState, severity: Severity::Error, type: 'bgpPeer',
|
||||||
|
reference: $bgpPeerIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bgpPeer->save();
|
$bgpPeer->save();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -56,7 +57,7 @@ class BgpEstablished implements SnmptrapHandler
|
|||||||
$bgpPeer->bgpPeerState = $trap->getOidData($state_oid);
|
$bgpPeer->bgpPeerState = $trap->getOidData($state_oid);
|
||||||
|
|
||||||
if ($bgpPeer->isDirty('bgpPeerState')) {
|
if ($bgpPeer->isDirty('bgpPeerState')) {
|
||||||
$trap->log('SNMP Trap: BGP Up ' . $bgpPeer->bgpPeerIdentifier . ' ' . get_astext($bgpPeer->bgpPeerRemoteAs) . ' is now ' . $bgpPeer->bgpPeerState, 1, 'bgpPeer', $bgpPeerIp);
|
$trap->log('SNMP Trap: BGP Up ' . $bgpPeer->bgpPeerIdentifier . ' ' . get_astext($bgpPeer->bgpPeerRemoteAs) . ' is now ' . $bgpPeer->bgpPeerState, Severity::Ok, 'bgpPeer', $bgpPeerIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bgpPeer->save();
|
$bgpPeer->save();
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -38,6 +39,6 @@ class BridgeNewRoot implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Device ' . $device->displayName() . ' was elected as new root on one of its Spanning Tree Instances', 3, 'stp');
|
$trap->log('SNMP Trap: Device ' . $device->displayName() . ' was elected as new root on one of its Spanning Tree Instances', Severity::Notice, 'stp');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -38,6 +39,6 @@ class BridgeTopologyChanged implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Topology of Spanning Tree Instance on device ' . $device->displayName() . ' was changed', 3, 'stp');
|
$trap->log('SNMP Trap: Topology of Spanning Tree Instance on device ' . $device->displayName() . ' was changed', Severity::Notice, 'stp');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -48,6 +49,6 @@ class CiscoDHCPServerFreeAddressHigh implements SnmptrapHandler
|
|||||||
$oid = $trap->findOid($oid_prefix);
|
$oid = $trap->findOid($oid_prefix);
|
||||||
$pool = str_replace($oid_prefix, '', $oid);
|
$pool = str_replace($oid_prefix, '', $oid);
|
||||||
$value = $trap->getOidData($oid);
|
$value = $trap->getOidData($oid);
|
||||||
$trap->log("SNMP Trap: DHCP pool $pool address space high. Free addresses: '$value' addresses.", 2);
|
$trap->log("SNMP Trap: DHCP pool $pool address space high. Free addresses: '$value' addresses.", Severity::Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -48,6 +49,6 @@ class CiscoDHCPServerFreeAddressLow implements SnmptrapHandler
|
|||||||
$oid = $trap->findOid($oid_prefix);
|
$oid = $trap->findOid($oid_prefix);
|
||||||
$pool = str_replace($oid_prefix, '', $oid);
|
$pool = str_replace($oid_prefix, '', $oid);
|
||||||
$value = $trap->getOidData($oid);
|
$value = $trap->getOidData($oid);
|
||||||
$trap->log("SNMP Trap: DHCP pool $pool address space low. Free addresses: '$value' addresses.", 5);
|
$trap->log("SNMP Trap: DHCP pool $pool address space low. Free addresses: '$value' addresses.", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -41,6 +42,6 @@ class CiscoDHCPServerStart implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Device DHCP service started.', 2);
|
$trap->log('SNMP Trap: Device DHCP service started.', Severity::Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -41,6 +42,6 @@ class CiscoDHCPServerStop implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Device DHCP service stopped.', 5);
|
$trap->log('SNMP Trap: Device DHCP service stopped.', Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -47,10 +48,10 @@ class CiscoErrDisableInterfaceEvent implements SnmptrapHandler
|
|||||||
$cause = $trap->getOidData($trap->findOid('CISCO-ERR-DISABLE-MIB::cErrDisableIfStatusCause.' . $ifIndex[1] . '.0'));
|
$cause = $trap->getOidData($trap->findOid('CISCO-ERR-DISABLE-MIB::cErrDisableIfStatusCause.' . $ifIndex[1] . '.0'));
|
||||||
|
|
||||||
if (! $port) {
|
if (! $port) {
|
||||||
$trap->log('SNMP TRAP: ' . $cause . ' error detected on unknown port. Either ifIndex is not found in the trap, or it does not match a port on this device.', 4);
|
$trap->log('SNMP TRAP: ' . $cause . ' error detected on unknown port. Either ifIndex is not found in the trap, or it does not match a port on this device.', Severity::Warning);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$trap->log('SNMP TRAP: ' . $cause . ' error detected on ' . $port->ifName . ' (Description: ' . $port->ifDescr . '). ' . $port->ifName . ' in err-disable state.', 4);
|
$trap->log('SNMP TRAP: ' . $cause . ' error detected on ' . $port->ifName . ' (Description: ' . $port->ifDescr . '). ' . $port->ifName . ' in err-disable state.', Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CiscoMacViolation implements SnmptrapHandler
|
|||||||
$ifName = $trap->getOidData($trap->findOid('IF-MIB::ifName'));
|
$ifName = $trap->getOidData($trap->findOid('IF-MIB::ifName'));
|
||||||
$mac = $trap->getOidData($trap->findOid('CISCO-PORT-SECURITY-MIB::cpsIfSecureLastMacAddress'));
|
$mac = $trap->getOidData($trap->findOid('CISCO-PORT-SECURITY-MIB::cpsIfSecureLastMacAddress'));
|
||||||
|
|
||||||
$trap->log("SNMP Trap: Secure MAC Address Violation on port $ifName. Last MAC address: $mac", 4);
|
$trap->log("SNMP Trap: Secure MAC Address Violation on port $ifName. Last MAC address: $mac", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -38,6 +39,6 @@ class ColdBoot implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Device ' . $device->displayName() . ' cold booted', 4, 'reboot');
|
$trap->log('SNMP Trap: Device ' . $device->displayName() . ' cold booted', Severity::Warning, 'reboot');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpLowBattery implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$battery = CyberPowerUtil::getMessage($trap);
|
$battery = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$battery", 4);
|
$trap->log("$battery", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpPowerRestored implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$power = CyberPowerUtil::getMessage($trap);
|
$power = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$power", 1);
|
$trap->log("$power", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpRtnDischarge implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$returnInfo = CyberPowerUtil::getMessage($trap);
|
$returnInfo = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$returnInfo", 1);
|
$trap->log("$returnInfo", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpRtnLowBattery implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$battery = CyberPowerUtil::getMessage($trap);
|
$battery = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$battery", 1);
|
$trap->log("$battery", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsChargerFailure implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$chargeInfo = CyberPowerUtil::getMessage($trap);
|
$chargeInfo = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$chargeInfo", 4);
|
$trap->log("$chargeInfo", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsDiagFailed implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$diagInfo = CyberPowerUtil::getMessage($trap);
|
$diagInfo = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$diagInfo", 5);
|
$trap->log("$diagInfo", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsOnBattery implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$battery = CyberPowerUtil::getMessage($trap);
|
$battery = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$battery", 4);
|
$trap->log("$battery", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsOverTemp implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$temp = CyberPowerUtil::getMessage($trap);
|
$temp = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$temp", 5);
|
$trap->log("$temp", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsOverload implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$overload = CyberPowerUtil::getMessage($trap);
|
$overload = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$overload", 5);
|
$trap->log("$overload", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsRebootStarted implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$status = CyberPowerUtil::getMessage($trap);
|
$status = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$status", 4);
|
$trap->log("$status", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsRtnChargerFailure implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$chargeInfo = CyberPowerUtil::getMessage($trap);
|
$chargeInfo = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$chargeInfo", 1);
|
$trap->log("$chargeInfo", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsRtnOverTemp implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$temp = CyberPowerUtil::getMessage($trap);
|
$temp = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$temp", 1);
|
$trap->log("$temp", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsRtnOverload implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$overload = CyberPowerUtil::getMessage($trap);
|
$overload = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$overload", 1);
|
$trap->log("$overload", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsSleeping implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$status = CyberPowerUtil::getMessage($trap);
|
$status = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$status", 4);
|
$trap->log("$status", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsTurnedOff implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$status = CyberPowerUtil::getMessage($trap);
|
$status = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$status", 4);
|
$trap->log("$status", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class CpUpsWokeUp implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$status = CyberPowerUtil::getMessage($trap);
|
$status = CyberPowerUtil::getMessage($trap);
|
||||||
$trap->log("$status", 1);
|
$trap->log("$status", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -38,6 +39,6 @@ class EntityDatabaseConfigChanged implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Configuration of Entity Database on device ' . $device->displayName() . ' was changed', 3, 'system');
|
$trap->log('SNMP Trap: Configuration of Entity Database on device ' . $device->displayName() . ' was changed', Severity::Notice, 'system');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -47,14 +48,14 @@ class EquipStatusTrap implements SnmptrapHandler
|
|||||||
$trap->log('SNMP Trap: Equipment Status ' . $state, $severity, 'state');
|
$trap->log('SNMP Trap: Equipment Status ' . $state, $severity, 'state');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSeverity(string $state): int
|
private function getSeverity(string $state): Severity
|
||||||
{
|
{
|
||||||
return match ($state) {
|
return match ($state) {
|
||||||
'warning', '3', 'major', '5' => 4,
|
'warning', '3', 'major', '5' => Severity::Warning,
|
||||||
'critical', '4' => 5,
|
'critical', '4' => Severity::Error,
|
||||||
'minor', '2' => 3,
|
'minor', '2' => Severity::Notice,
|
||||||
'nonAlarmed', '1' => 1,
|
'nonAlarmed', '1' => Severity::Ok,
|
||||||
default => 0,
|
default => Severity::Unknown,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -38,6 +39,6 @@ class FailedUserLogin implements SnmptrapHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$trap->log('SNMP Trap: Failed User Login: ' . $device->displayName(), 4, 'auth');
|
$trap->log('SNMP Trap: Failed User Login: ' . $device->displayName(), Severity::Warning, 'auth');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -45,6 +46,6 @@ class FgTrapIpsAnomaly implements SnmptrapHandler
|
|||||||
{
|
{
|
||||||
$srcIp = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSrcIp'));
|
$srcIp = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSrcIp'));
|
||||||
$proto = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSigMsg'));
|
$proto = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSigMsg'));
|
||||||
$trap->log("DDoS prevention triggered. Source: $srcIp Protocol: $proto", 4);
|
$trap->log("DDoS prevention triggered. Source: $srcIp Protocol: $proto", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -46,6 +47,6 @@ class FgTrapIpsSignature implements SnmptrapHandler
|
|||||||
$srcIp = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSrcIp'));
|
$srcIp = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSrcIp'));
|
||||||
$sigNum = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSigId'));
|
$sigNum = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSigId'));
|
||||||
$sigName = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSigMsg'));
|
$sigName = $trap->getOidData($trap->findOid('FORTINET-FORTIGATE-MIB::fgIpsTrapSigMsg'));
|
||||||
$trap->log("IPS signature $sigName detected from $srcIp with Fortiguard ID $sigNum", 4);
|
$trap->log("IPS signature $sigName detected from $srcIp with Fortiguard ID $sigNum", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -45,6 +46,6 @@ class FgTrapVpnTunDown implements SnmptrapHandler
|
|||||||
{
|
{
|
||||||
$remoteGw = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapRemoteGateway'));
|
$remoteGw = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapRemoteGateway'));
|
||||||
$tunName = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapPhase1Name'));
|
$tunName = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapPhase1Name'));
|
||||||
$trap->log("VPN tunnel $tunName to $remoteGw is down", 3);
|
$trap->log("VPN tunnel $tunName to $remoteGw is down", Severity::Notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -45,6 +46,6 @@ class FgTrapVpnTunUp implements SnmptrapHandler
|
|||||||
{
|
{
|
||||||
$remoteGw = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapRemoteGateway'));
|
$remoteGw = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapRemoteGateway'));
|
||||||
$tunName = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapPhase1Name'));
|
$tunName = $trap->getOidData($trap->findOid('FORTIGATE-MIB::fgVpnTrapPhase1Name'));
|
||||||
$trap->log("VPN tunnel $tunName to $remoteGw is up", 1);
|
$trap->log("VPN tunnel $tunName to $remoteGw is up", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -46,6 +47,6 @@ class FmTrapLogRateThreshold implements SnmptrapHandler
|
|||||||
{
|
{
|
||||||
$logRate = $trap->getOidData($trap->findOid('FORTINET-FORTIMANAGER-FORTIANALYZER-MIB::fmLogRate'));
|
$logRate = $trap->getOidData($trap->findOid('FORTINET-FORTIMANAGER-FORTIANALYZER-MIB::fmLogRate'));
|
||||||
$logThresh = $trap->getOidData($trap->findOid('FORTINET-FORTIMANAGER-FORTIANALYZER-MIB::fmLogRateThreshold'));
|
$logThresh = $trap->getOidData($trap->findOid('FORTINET-FORTIMANAGER-FORTIANALYZER-MIB::fmLogRateThreshold'));
|
||||||
$trap->log("Recommended log rate exceeded. Current Rate: $logRate Recommended Rate: $logThresh", 3);
|
$trap->log("Recommended log rate exceeded. Current Rate: $logRate Recommended Rate: $logThresh", Severity::Notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -21,16 +22,16 @@ class HpFault implements SnmptrapHandler
|
|||||||
$type = $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfLogFaultType'));
|
$type = $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfLogFaultType'));
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'badXcvr':
|
case 'badXcvr':
|
||||||
$trap->log('Fault - CRC Error ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 4, $type);
|
$trap->log('Fault - CRC Error ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), Severity::Warning, $type);
|
||||||
break;
|
break;
|
||||||
case 'badCable':
|
case 'badCable':
|
||||||
$trap->log('Fault - Bad Cable ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 4, $type);
|
$trap->log('Fault - Bad Cable ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), Severity::Warning, $type);
|
||||||
break;
|
break;
|
||||||
case 'bcastStorm':
|
case 'bcastStorm':
|
||||||
$trap->log('Fault - Broadcaststorm ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 5, $type);
|
$trap->log('Fault - Broadcaststorm ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), Severity::Error, $type);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$trap->log('Fault - Unhandled ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 2, $type);
|
$trap->log('Fault - Unhandled ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), Severity::Info, $type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use LibreNMS\Util\IP;
|
use LibreNMS\Util\IP;
|
||||||
@ -61,7 +62,7 @@ class JnxBgpM2BackwardTransition implements SnmptrapHandler
|
|||||||
$bgpPeer->bgpPeerState = $peerState;
|
$bgpPeer->bgpPeerState = $peerState;
|
||||||
|
|
||||||
if ($bgpPeer->isDirty('bgpPeerState')) {
|
if ($bgpPeer->isDirty('bgpPeerState')) {
|
||||||
$trap->log("BGP Peer $peerAddr is now in the $peerState state", 5);
|
$trap->log("BGP Peer $peerAddr is now in the $peerState state", Severity::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bgpPeer->save();
|
$bgpPeer->save();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use LibreNMS\Util\IP;
|
use LibreNMS\Util\IP;
|
||||||
@ -57,7 +58,7 @@ class JnxBgpM2Established implements SnmptrapHandler
|
|||||||
$bgpPeer->bgpPeerState = $peerState;
|
$bgpPeer->bgpPeerState = $peerState;
|
||||||
|
|
||||||
if ($bgpPeer->isDirty('bgpPeerState')) {
|
if ($bgpPeer->isDirty('bgpPeerState')) {
|
||||||
$trap->log("BGP Peer $peerAddr is now in the $peerState state", 1);
|
$trap->log("BGP Peer $peerAddr is now in the $peerState state", Severity::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bgpPeer->save();
|
$bgpPeer->save();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class JnxDomAlarmCleared implements SnmptrapHandler
|
|||||||
$currentAlarm = $trap->getOidData($trap->findOid('JUNIPER-DOM-MIB::jnxDomCurrentAlarms'));
|
$currentAlarm = $trap->getOidData($trap->findOid('JUNIPER-DOM-MIB::jnxDomCurrentAlarms'));
|
||||||
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
||||||
$alarmList = JnxDomAlarmId::getAlarms($currentAlarm);
|
$alarmList = JnxDomAlarmId::getAlarms($currentAlarm);
|
||||||
$trap->log("DOM alarm cleared for interface $ifDescr. Cleared alarm(s): $alarmList", 1);
|
$trap->log("DOM alarm cleared for interface $ifDescr. Cleared alarm(s): $alarmList", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class JnxDomAlarmSet implements SnmptrapHandler
|
|||||||
$currentAlarm = $trap->getOidData($trap->findOid('JUNIPER-DOM-MIB::jnxDomCurrentAlarms'));
|
$currentAlarm = $trap->getOidData($trap->findOid('JUNIPER-DOM-MIB::jnxDomCurrentAlarms'));
|
||||||
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
$ifDescr = $trap->getOidData($trap->findOid('IF-MIB::ifDescr'));
|
||||||
$alarmList = JnxDomAlarmId::getAlarms($currentAlarm);
|
$alarmList = JnxDomAlarmId::getAlarms($currentAlarm);
|
||||||
$trap->log("DOM alarm set for interface $ifDescr. Current alarm(s): $alarmList", 5);
|
$trap->log("DOM alarm set for interface $ifDescr. Current alarm(s): $alarmList", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -56,6 +57,6 @@ class JnxDomLaneAlarmCleared implements SnmptrapHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$trap->log("DOM lane alarm cleared on interface $port->ifDescr lane $lane. Current alarm(s): $alarmList", 1);
|
$trap->log("DOM lane alarm cleared on interface $port->ifDescr lane $lane. Current alarm(s): $alarmList", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -54,6 +55,6 @@ class JnxDomLaneAlarmSet implements SnmptrapHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$trap->log("DOM lane alarm on interface $port->ifDescr lane $lane. Current alarm(s): $alarmList", 5);
|
$trap->log("DOM lane alarm on interface $port->ifDescr lane $lane. Current alarm(s): $alarmList", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -46,6 +47,6 @@ class JnxLdpLspDown implements SnmptrapHandler
|
|||||||
$reason = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpLspDownReason'));
|
$reason = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpLspDownReason'));
|
||||||
$instanceName = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpInstanceName'));
|
$instanceName = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpInstanceName'));
|
||||||
|
|
||||||
$trap->log("LDP session $instanceName from $routerID to $lspForward has gone down due to $reason", 4);
|
$trap->log("LDP session $instanceName from $routerID to $lspForward has gone down due to $reason", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -45,6 +46,6 @@ class JnxLdpLspUp implements SnmptrapHandler
|
|||||||
$routerID = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpRtrid'));
|
$routerID = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpRtrid'));
|
||||||
$instanceName = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpInstanceName'));
|
$instanceName = $trap->getOidData($trap->findOid('JUNIPER-LDP-MIB::jnxLdpInstanceName'));
|
||||||
|
|
||||||
$trap->log("LDP session $instanceName from $routerID to $lspForward is now up.", 1);
|
$trap->log("LDP session $instanceName from $routerID to $lspForward is now up.", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -53,6 +54,6 @@ class JnxLdpSesDown implements SnmptrapHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$trap->log("LDP session on interface $port->ifDescr is $state due to $reason", 4);
|
$trap->log("LDP session on interface $port->ifDescr is $state due to $reason", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -52,6 +53,6 @@ class JnxLdpSesUp implements SnmptrapHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$trap->log("LDP session on interface $port->ifDescr is $state", 1);
|
$trap->log("LDP session on interface $port->ifDescr is $state", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -43,6 +44,6 @@ class JnxPowerSupplyFailure implements SnmptrapHandler
|
|||||||
{
|
{
|
||||||
$powerSupply = $trap->getOidData($trap->findOid('JUNIPER-MIB::jnxContentsDescr'));
|
$powerSupply = $trap->getOidData($trap->findOid('JUNIPER-MIB::jnxContentsDescr'));
|
||||||
$state = $trap->getOidData($trap->findOid('JUNIPER-MIB::jnxOperatingState'));
|
$state = $trap->getOidData($trap->findOid('JUNIPER-MIB::jnxOperatingState'));
|
||||||
$trap->log("Power Supply $powerSupply is $state", 5);
|
$trap->log("Power Supply $powerSupply is $state", Severity::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -42,6 +43,6 @@ class JnxPowerSupplyOk implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$powerSupply = $trap->getOidData($trap->findOid('JUNIPER-MIB::jnxContentsDescr'));
|
$powerSupply = $trap->getOidData($trap->findOid('JUNIPER-MIB::jnxContentsDescr'));
|
||||||
$trap->log("Power Supply $powerSupply is OK", 1);
|
$trap->log("Power Supply $powerSupply is OK", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class JnxVpnIfDown implements SnmptrapHandler
|
|||||||
$vpnType = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnIfVpnType'));
|
$vpnType = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnIfVpnType'));
|
||||||
$vpnName = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnIfVpnName'));
|
$vpnName = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnIfVpnName'));
|
||||||
|
|
||||||
$trap->log("$vpnType on interface $vpnName has gone down", 4);
|
$trap->log("$vpnType on interface $vpnName has gone down", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -46,9 +47,9 @@ class JnxVpnIfUp implements SnmptrapHandler
|
|||||||
|
|
||||||
if (substr($vpnName, 0, 6) === 'vt/lsi') {
|
if (substr($vpnName, 0, 6) === 'vt/lsi') {
|
||||||
$vpnDevice = substr($vpnName, 7, 15);
|
$vpnDevice = substr($vpnName, 7, 15);
|
||||||
$trap->log("$vpnType to device $vpnDevice is now connected", 1);
|
$trap->log("$vpnType to device $vpnDevice is now connected", Severity::Ok);
|
||||||
} else {
|
} else {
|
||||||
$trap->log("$vpnType on interface $vpnName is now connected", 1);
|
$trap->log("$vpnType on interface $vpnName is now connected", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class JnxVpnPwDown implements SnmptrapHandler
|
|||||||
$vpnType = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnType'));
|
$vpnType = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnType'));
|
||||||
$vpnName = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnName'));
|
$vpnName = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnName'));
|
||||||
|
|
||||||
$trap->log("$vpnType on a pseudowire belonging to $vpnName has gone down", 4);
|
$trap->log("$vpnType on a pseudowire belonging to $vpnName has gone down", Severity::Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -44,6 +45,6 @@ class JnxVpnPwUp implements SnmptrapHandler
|
|||||||
$vpnType = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnType'));
|
$vpnType = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnType'));
|
||||||
$vpnName = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnName'));
|
$vpnName = $trap->getOidData($trap->findOid('JUNIPER-VPN-MIB::jnxVpnPwVpnName'));
|
||||||
|
|
||||||
$trap->log("$vpnType on a pseudowire belonging to $vpnName is now connected", 1);
|
$trap->log("$vpnType on a pseudowire belonging to $vpnName is now connected", Severity::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -58,14 +59,14 @@ class LinkDown implements SnmptrapHandler
|
|||||||
if ($trapAdminStatus) {
|
if ($trapAdminStatus) {
|
||||||
$port->ifAdminStatus = $trapAdminStatus;
|
$port->ifAdminStatus = $trapAdminStatus;
|
||||||
}
|
}
|
||||||
$trap->log("SNMP Trap: linkDown $port->ifAdminStatus/$port->ifOperStatus " . $port->ifDescr, 5, 'interface', $port->port_id);
|
$trap->log("SNMP Trap: linkDown $port->ifAdminStatus/$port->ifOperStatus " . $port->ifDescr, Severity::Error, 'interface', $port->port_id);
|
||||||
|
|
||||||
if ($port->isDirty('ifAdminStatus')) {
|
if ($port->isDirty('ifAdminStatus')) {
|
||||||
$trap->log("Interface Disabled : $port->ifDescr (TRAP)", 3, 'interface', $port->port_id);
|
$trap->log("Interface Disabled : $port->ifDescr (TRAP)", Severity::Notice, 'interface', $port->port_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($port->isDirty('ifOperStatus')) {
|
if ($port->isDirty('ifOperStatus')) {
|
||||||
$trap->log("Interface went Down : $port->ifDescr (TRAP)", 5, 'interface', $port->port_id);
|
$trap->log("Interface went Down : $port->ifDescr (TRAP)", Severity::Error, 'interface', $port->port_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$port->save();
|
$port->save();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -55,14 +56,14 @@ class LinkUp implements SnmptrapHandler
|
|||||||
$port->ifOperStatus = $trap->getOidData("IF-MIB::ifOperStatus.$ifIndex") ?: 'up';
|
$port->ifOperStatus = $trap->getOidData("IF-MIB::ifOperStatus.$ifIndex") ?: 'up';
|
||||||
$port->ifAdminStatus = $trap->getOidData("IF-MIB::ifAdminStatus.$ifIndex") ?: 'up'; // If we receive LinkUp trap, we can safely assume that the ifAdminStatus is also up.
|
$port->ifAdminStatus = $trap->getOidData("IF-MIB::ifAdminStatus.$ifIndex") ?: 'up'; // If we receive LinkUp trap, we can safely assume that the ifAdminStatus is also up.
|
||||||
|
|
||||||
$trap->log("SNMP Trap: linkUp $port->ifAdminStatus/$port->ifOperStatus " . $port->ifDescr, 1, 'interface', $port->port_id);
|
$trap->log("SNMP Trap: linkUp $port->ifAdminStatus/$port->ifOperStatus " . $port->ifDescr, Severity::Ok, 'interface', $port->port_id);
|
||||||
|
|
||||||
if ($port->isDirty('ifAdminStatus')) {
|
if ($port->isDirty('ifAdminStatus')) {
|
||||||
$trap->log("Interface Enabled : $port->ifDescr (TRAP)", 3, 'interface', $port->port_id);
|
$trap->log("Interface Enabled : $port->ifDescr (TRAP)", Severity::Notice, 'interface', $port->port_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($port->isDirty('ifOperStatus')) {
|
if ($port->isDirty('ifOperStatus')) {
|
||||||
$trap->log("Interface went Up : $port->ifDescr (TRAP)", 1, 'interface', $port->port_id);
|
$trap->log("Interface went Up : $port->ifDescr (TRAP)", Severity::Ok, 'interface', $port->port_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$port->save();
|
$port->save();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -54,14 +55,14 @@ class LogTrap implements SnmptrapHandler
|
|||||||
$trap->log('SNMP Trap: Log ' . $logName . ' ' . $logEvent . ' ' . $logPC . ' ' . $logAI . ' ' . $state, $severity, 'log');
|
$trap->log('SNMP Trap: Log ' . $logName . ' ' . $logEvent . ' ' . $logPC . ' ' . $logAI . ' ' . $state, $severity, 'log');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSeverity(string $state): int
|
private function getSeverity(string $state): Severity
|
||||||
{
|
{
|
||||||
return match ($state) {
|
return match ($state) {
|
||||||
'warning', '3', 'major', '5' => 4,
|
'warning', '3', 'major', '5' => Severity::Warning,
|
||||||
'critical', '4' => 5,
|
'critical', '4' => Severity::Error,
|
||||||
'minor', '2' => 3,
|
'minor', '2' => Severity::Notice,
|
||||||
'nonAlarmed', '1' => 1,
|
'nonAlarmed', '1' => Severity::Ok,
|
||||||
default => 0,
|
default => Severity::Unknown,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -69,29 +70,13 @@ class Mgnt2TrapNmsAlarm implements SnmptrapHandler
|
|||||||
$msg = "Alarm on slot $slot, $sourcePm Issue: $probSpecific Possible Cause: $probCause";
|
$msg = "Alarm on slot $slot, $sourcePm Issue: $probSpecific Possible Cause: $probCause";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($alarmSeverity) {
|
$severity = match ($alarmSeverity) {
|
||||||
case 'cleared':
|
'cleared' => Severity::Ok,
|
||||||
$severity = 1;
|
'critical', 'major' => Severity::Error,
|
||||||
break;
|
'minor', 'warning' => Severity::Warning,
|
||||||
case 'critical':
|
'indeterminate' => Severity::Unknown,
|
||||||
$severity = 5;
|
default => Severity::Info,
|
||||||
break;
|
};
|
||||||
case 'major':
|
|
||||||
$severity = 5;
|
|
||||||
break;
|
|
||||||
case 'minor':
|
|
||||||
$severity = 4;
|
|
||||||
break;
|
|
||||||
case 'warning':
|
|
||||||
$severity = 4;
|
|
||||||
break;
|
|
||||||
case 'indeterminate':
|
|
||||||
$severity = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$severity = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$trap->log($msg, $severity);
|
$trap->log($msg, $severity);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -58,32 +59,12 @@ class OspfIfStateChange implements SnmptrapHandler
|
|||||||
|
|
||||||
$ospfPort->ospfIfState = $trap->getOidData($trap->findOid('OSPF-MIB::ospfIfState'));
|
$ospfPort->ospfIfState = $trap->getOidData($trap->findOid('OSPF-MIB::ospfIfState'));
|
||||||
|
|
||||||
switch ($ospfPort->ospfIfState) {
|
$severity = match ($ospfPort->ospfIfState) {
|
||||||
case 'down':
|
'down' => Severity::Error,
|
||||||
$severity = 5;
|
'designatedRouter', 'backupDesignatedRouter', 'otherDesignatedRouter', 'pointToPoint' => Severity::Ok,
|
||||||
break;
|
'waiting', 'loopback' => Severity::Warning,
|
||||||
case 'designatedRouter':
|
default => Severity::Unknown,
|
||||||
$severity = 1;
|
};
|
||||||
break;
|
|
||||||
case 'backupDesignatedRouter':
|
|
||||||
$severity = 1;
|
|
||||||
break;
|
|
||||||
case 'otherDesignatedRouter':
|
|
||||||
$severity = 1;
|
|
||||||
break;
|
|
||||||
case 'pointToPoint':
|
|
||||||
$severity = 1;
|
|
||||||
break;
|
|
||||||
case 'waiting':
|
|
||||||
$severity = 4;
|
|
||||||
break;
|
|
||||||
case 'loopback':
|
|
||||||
$severity = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$severity = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$trap->log("OSPF interface $port->ifName is $ospfPort->ospfIfState", $severity);
|
$trap->log("OSPF interface $port->ifName is $ospfPort->ospfIfState", $severity);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -49,13 +50,11 @@ class OspfNbrStateChange implements SnmptrapHandler
|
|||||||
|
|
||||||
$ospfNbr->ospfNbrState = $trap->getOidData($trap->findOid('OSPF-MIB::ospfNbrState'));
|
$ospfNbr->ospfNbrState = $trap->getOidData($trap->findOid('OSPF-MIB::ospfNbrState'));
|
||||||
|
|
||||||
$severity = 4;
|
$severity = match ($ospfNbr->ospfNbrState) {
|
||||||
|
'full' => Severity::Ok,
|
||||||
if ($ospfNbr->ospfNbrState == 'full') {
|
'down' => Severity::Error,
|
||||||
$severity = 1;
|
default => Severity::Warning,
|
||||||
} elseif ($ospfNbr->ospfNbrState == 'down') {
|
};
|
||||||
$severity = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
$trap->log("OSPF neighbor $ospfNbrIpAddr changed state to $ospfNbr->ospfNbrState", $severity);
|
$trap->log("OSPF neighbor $ospfNbrIpAddr changed state to $ospfNbr->ospfNbrState", $severity);
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
@ -48,6 +49,6 @@ class RuckusSzClusterInMaintenance implements SnmptrapHandler
|
|||||||
public function handle(Device $device, Trap $trap)
|
public function handle(Device $device, Trap $trap)
|
||||||
{
|
{
|
||||||
$clusterName = $trap->getOidData($trap->findOid('RUCKUS-SZ-EVENT-MIB::ruckusSZClusterName'));
|
$clusterName = $trap->getOidData($trap->findOid('RUCKUS-SZ-EVENT-MIB::ruckusSZClusterName'));
|
||||||
$trap->log("Smartzone cluster $clusterName state changed to maintenance", 3);
|
$trap->log("Smartzone cluster $clusterName state changed to maintenance", Severity::Notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,15 +28,17 @@
|
|||||||
|
|
||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
|
|
||||||
class RuckusSzSeverity
|
class RuckusSzSeverity
|
||||||
{
|
{
|
||||||
public static function getSeverity(string $severity): int
|
public static function getSeverity(string $severity): Severity
|
||||||
{
|
{
|
||||||
return match ($severity) {
|
return match ($severity) {
|
||||||
'Critical' => 5,
|
'Critical' => Severity::Error,
|
||||||
'Major', 'Minor' => 4,
|
'Major', 'Minor' => Severity::Warning,
|
||||||
'Warning' => 3,
|
'Warning' => Severity::Notice,
|
||||||
default => 2 // Informational
|
default => Severity::Info,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,20 @@
|
|||||||
|
|
||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use Illuminate\Support\Arr;
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
class Tripplite
|
class Tripplite
|
||||||
{
|
{
|
||||||
protected function getSeverity(Trap $trap): int
|
protected function getSeverity(Trap $trap): Severity
|
||||||
{
|
{
|
||||||
return Arr::get([
|
return match ($trap->getOidData('TRIPPLITE-PRODUCTS::tlpAlarmType')) {
|
||||||
'critical' => 5,
|
'critical' => Severity::Error,
|
||||||
'warning' => 4,
|
'warning' => Severity::Warning,
|
||||||
'info' => 2,
|
'info' => Severity::Info,
|
||||||
'status' => 3,
|
'status' => Severity::Notice,
|
||||||
], $trap->getOidData('TRIPPLITE-PRODUCTS::tlpAlarmType'), 4);
|
default => Severity::Warning,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function describe(Trap $trap): string
|
protected function describe(Trap $trap): string
|
||||||
|
@ -26,6 +26,7 @@ namespace LibreNMS\Snmptrap\Handlers;
|
|||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -44,7 +45,7 @@ class UpsTrapOnBattery implements SnmptrapHandler
|
|||||||
{
|
{
|
||||||
$min_remaining = (int) Str::before($trap->getOidData($trap->findOid('UPS-MIB::upsEstimatedMinutesRemaining')), ' ');
|
$min_remaining = (int) Str::before($trap->getOidData($trap->findOid('UPS-MIB::upsEstimatedMinutesRemaining')), ' ');
|
||||||
$sec_time = (int) Str::before($trap->getOidData($trap->findOid('UPS-MIB::upsSecondsOnBattery')), ' ');
|
$sec_time = (int) Str::before($trap->getOidData($trap->findOid('UPS-MIB::upsSecondsOnBattery')), ' ');
|
||||||
$trap->log("UPS running on battery for $sec_time seconds. Estimated $min_remaining minutes remaining", 5);
|
$trap->log("UPS running on battery for $sec_time seconds. Estimated $min_remaining minutes remaining", Severity::Error);
|
||||||
$sensor_remaining = $device->sensors()->where('sensor_index', '200')->where('sensor_type', 'rfc1628')->first();
|
$sensor_remaining = $device->sensors()->where('sensor_index', '200')->where('sensor_type', 'rfc1628')->first();
|
||||||
if (! $sensor_remaining) {
|
if (! $sensor_remaining) {
|
||||||
Log::warning("Snmptrap upsTrapOnBattery: Could not find matching sensor \'Estimated battery time remaining\' for device: " . $device->hostname);
|
Log::warning("Snmptrap upsTrapOnBattery: Could not find matching sensor \'Estimated battery time remaining\' for device: " . $device->hostname);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -50,6 +51,6 @@ class UpsmgUtilityFailure implements SnmptrapHandler
|
|||||||
}
|
}
|
||||||
$sensor->sensor_current = 1;
|
$sensor->sensor_current = 1;
|
||||||
$sensor->save();
|
$sensor->save();
|
||||||
$trap->log('UPS power failed, state sensor ' . $sensor->sensor_descr . ' has changed to ' . $sensor->sensor_current . '.', 5, 'Power');
|
$trap->log('UPS power failed, state sensor ' . $sensor->sensor_descr . ' has changed to ' . $sensor->sensor_current . '.', Severity::Error, 'Power');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
use Log;
|
use Log;
|
||||||
@ -48,6 +49,6 @@ class UpsmgUtilityRestored implements SnmptrapHandler
|
|||||||
}
|
}
|
||||||
$sensor->sensor_current = 2;
|
$sensor->sensor_current = 2;
|
||||||
$sensor->save();
|
$sensor->save();
|
||||||
$trap->log('UPS power restored, state sensor ' . $sensor->sensor_descr . ' has changed to ' . $sensor->sensor_current . '.', 1, 'Power');
|
$trap->log('UPS power restored, state sensor ' . $sensor->sensor_descr . ' has changed to ' . $sensor->sensor_current . '.', Severity::Ok, 'Power');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use App\Models\Device;
|
|||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
class VeeamBackupJobCompleted implements SnmptrapHandler
|
class VeeamBackupJobCompleted extends VeeamTrap implements SnmptrapHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle snmptrap.
|
* Handle snmptrap.
|
||||||
@ -21,8 +21,8 @@ class VeeamBackupJobCompleted implements SnmptrapHandler
|
|||||||
$name = $trap->getOidData('VEEAM-MIB::backupJobName');
|
$name = $trap->getOidData('VEEAM-MIB::backupJobName');
|
||||||
$comment = $trap->getOidData('VEEAM-MIB::backupJobComment');
|
$comment = $trap->getOidData('VEEAM-MIB::backupJobComment');
|
||||||
$result = $trap->getOidData('VEEAM-MIB::backupJobResult');
|
$result = $trap->getOidData('VEEAM-MIB::backupJobResult');
|
||||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
$severity = $this->getResultSeverity($result);
|
||||||
|
|
||||||
$trap->log('SNMP Trap: Backup Job ' . $result . ' - ' . $name . ' - ' . $comment, $color[$result], 'backup');
|
$trap->log('SNMP Trap: Backup Job ' . $result . ' - ' . $name . ' - ' . $comment, $severity, 'backup');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use App\Models\Device;
|
|||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
class VeeamCdpRpoReport implements SnmptrapHandler
|
class VeeamCdpRpoReport extends VeeamTrap implements SnmptrapHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle snmptrap.
|
* Handle snmptrap.
|
||||||
@ -21,8 +21,8 @@ class VeeamCdpRpoReport implements SnmptrapHandler
|
|||||||
$policy_name = $trap->getOidData('VEEAM-MIB::cdpPolicyName');
|
$policy_name = $trap->getOidData('VEEAM-MIB::cdpPolicyName');
|
||||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||||
$result = $trap->getOidData('VEEAM-MIB::cdpRpoStatus');
|
$result = $trap->getOidData('VEEAM-MIB::cdpRpoStatus');
|
||||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
$severity = $this->getResultSeverity($result);
|
||||||
|
|
||||||
$trap->log('SNMP Trap: CDP policy RPO status change' . $result . ' - ' . $policy_name . ' ' . $vm_name, $color[$result], 'policy');
|
$trap->log('SNMP Trap: CDP policy RPO status change' . $result . ' - ' . $policy_name . ' ' . $vm_name, $severity, 'policy');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use App\Models\Device;
|
|||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
class VeeamLinuxFLRCopyToFinished implements SnmptrapHandler
|
class VeeamLinuxFLRCopyToFinished extends VeeamTrap implements SnmptrapHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle snmptrap.
|
* Handle snmptrap.
|
||||||
@ -24,8 +24,8 @@ class VeeamLinuxFLRCopyToFinished implements SnmptrapHandler
|
|||||||
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
||||||
$time = $trap->getOidData('VEEAM-MIB::transferTime');
|
$time = $trap->getOidData('VEEAM-MIB::transferTime');
|
||||||
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
||||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
$severity = $this->getResultSeverity($result);
|
||||||
|
|
||||||
$trap->log('SNMP Trap: FLR job ' . $result . ' - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_host . ' ' . $target_dir . ' Time taken: ' . $time, $color[$result], 'backup');
|
$trap->log('SNMP Trap: FLR job ' . $result . ' - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_host . ' ' . $target_dir . ' Time taken: ' . $time, $severity, 'backup');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
class VeeamLinuxFLRCopyToStarted implements SnmptrapHandler
|
class VeeamLinuxFLRCopyToStarted extends VeeamTrap implements SnmptrapHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle snmptrap.
|
* Handle snmptrap.
|
||||||
@ -23,6 +24,6 @@ class VeeamLinuxFLRCopyToStarted implements SnmptrapHandler
|
|||||||
$target_host = $trap->getOidData('VEEAM-MIB::targetHost');
|
$target_host = $trap->getOidData('VEEAM-MIB::targetHost');
|
||||||
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
||||||
|
|
||||||
$trap->log('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_dir . ' ' . $target_host, 2, 'backup');
|
$trap->log('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_dir . ' ' . $target_host, Severity::Info, 'backup');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
namespace LibreNMS\Snmptrap\Handlers;
|
namespace LibreNMS\Snmptrap\Handlers;
|
||||||
|
|
||||||
use App\Models\Device;
|
use App\Models\Device;
|
||||||
|
use LibreNMS\Enum\Severity;
|
||||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||||
use LibreNMS\Snmptrap\Trap;
|
use LibreNMS\Snmptrap\Trap;
|
||||||
|
|
||||||
class VeeamLinuxFLRMountStarted implements SnmptrapHandler
|
class VeeamLinuxFLRMountStarted extends VeeamTrap implements SnmptrapHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle snmptrap.
|
* Handle snmptrap.
|
||||||
@ -21,6 +22,6 @@ class VeeamLinuxFLRMountStarted implements SnmptrapHandler
|
|||||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||||
|
|
||||||
$trap->log('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, 2, 'backup');
|
$trap->log('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, Severity::Info, 'backup');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user