librenms-librenms/doc/Extensions/SNMP-Trap-Handler.md
Tony Murray 4c6f917d9e Updates to snmptrap handling (#9010)
* 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.
2018-08-14 07:56:16 +01:00

1.1 KiB

source: Extensions/SNMP-Trap-Handler.md

SNMP trap handling

Currently, librenms only supports linkUp/linkDown (port up/down), bgpEstablished/bgpBackwardTransition (BGP Sessions Up/Down) and authenticationFailure SNMP traps. To add more see Adding new SNMP Trap handlers

Traps are handled via snmptrapd.

Configure snmptrapd

Install snmptrapd via your package manager.

Modify startup options to include -M /opt/librenms/mibs -m ALL

In /etc/snmp/snmptrapd.conf, add something like the following:

traphandle default /opt/librenms/snmptrap.php

Along with any necessary configuration to receive the traps from your devices (community, etc.)

Event logging

You can configure generic event logging for snmp traps. This will log an event of the type trap for received traps. These events can be utilized for alerting.

In config.php

$config['snmptraps']['eventlog'] = 'unhandled';

Valid options are:

  • unhandled only unhandled traps will be logged
  • all log all traps
  • none no traps will create a generic event log (handled traps may still log events)