Im having an issue with snmptraps in Librenms.
Im using Huawei equipment that generates Dying gasps on power failure. I want these traps in the event log but in a more human friendly format. I already set this up and it worked for a while but last few months it hasnt. Ive now set up a new blank Librenms to test but to no avail. I cant figure out where the problem is. Any suggestions based on the following?
Snmptrapd is working as expected. Logs confirm that i receive all traps, but seems there is something wrong with my handler.
My handler:
/opt/librenms/LibreNMS/Snmptrap/Handlers/HuaDG.php
<?php
namespace LibreNMS\Snmptrap\Handlers;
use App\Models\Device;
use LibreNMS\Interfaces\SnmptrapHandler;
use LibreNMS\Snmptrap\Trap;
use Log;
class HuaDG implements SnmptrapHandler
{
public function handle(Device $device, Trap $trap)
{
$dyinggasp = $trap->getOidData($trap->findOid('HUAWEI-BASE-TRAP-MIB::hwEntityDyingGasp'));
Log::event("Dying Gasp received", $device->device_id, 'trap', 5);
}
}
?>
Added the following to /opt/librenms/config/snmptraps.php:
‘HUAWEI-BASE-TRAP-MIB::hwEntityDyingGasp’ => \LibreNMS\Snmptrap\Handlers\HuaDG::class,
/opt/librenms/logs/librenms.log shows the following:
production.ERROR: Call to undefined method Monolog\Logger::event() {“exception”:“[object] (Error(code: 0): Call to undefined method Monolog\Logger::event() at /opt/librenms/vendor/laravel/framework/src/Illuminate/Log/Logger.php:308)”}
Contents of that file line 308 is “return $this->logger->{$method}(…$parameters);”.
public function __call($method, $parameters)
{
return $this->logger->{$method}(...$parameters);
}
}
Event is no longer a method?