mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Updates to snmptrap handling fix a bug in findDeviceByIP. Add more tests for that. Move handle outside of the Trap class, it doesn't fit. Add developer docs. * fix tests copy paste issue. * Fix findByIp when port may not exist. * Logging: Output context (and extra) if they exist * Generic trap event logging and new config setting.
37 lines
744 B
PHP
37 lines
744 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
|
use LibreNMS\Snmptrap\Handlers\Fallback;
|
|
|
|
class SnmptrapProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Register the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app->bind(SnmptrapHandler::class, function ($app, $oid) {
|
|
if ($handler = config('snmptraps.trap_handlers.' . reset($oid))) {
|
|
return $app->make($handler);
|
|
}
|
|
|
|
return $app->make(Fallback::class);
|
|
});
|
|
}
|
|
}
|