librenms-librenms/doc/Extensions/SNMP-Trap-Handler.md
Zane C. Bowers-Hadley e4c9153d16 more documentation clean up (#10577)
* fix a few bare URLs

* make mdl happy

* make Weathermap.md as mdl happy as possible

* make Varnish.md as mdl happy as possible

* make Two-Factor-Auth.md mdl happy

* touch one header for Syslog.md, but little can be done about the rest

* make Sub-Directory.md as mdl happy as possible

* make SNMP-Trap-Handler.md lint happy

* make SNMP-Proxy.md mdl happy

* make Smokeping.md as mdl happy as possible

* make Services.md mdl happy

* make RRDTune.md mdl happy

* cleanup RRDCached.md as much as possible

* make RRDCached-Security.md mdl happy

* make Rancid.md as mdl happy as possible

* make Proxmox.md mdl happy

* make Plugin-System.md as mdl happy as possible

* make PeeringDB.md mdl happy

* make Oxidized.md more lint happy

* make Network-Map.md mdl happy

* make MIB-based-polling.md as mdl happy as possible

* make Metric-Storage.md mdl happy

* make IRC-Bot.md as mdl happy as possible

* make IRC-Bot-Extensions.md as mdl happy as possible

* make

* make Graylog.md mdl happy

* make Gateone.md mdl happy

* make Fast-Ping-Check.md mdl happy

* make Distributed-Poller.md as mdl happy as possible

* make Dispatcher-Service.md as mdl happy as possible

* make Device-Groups.md mdl happy

* make Dell-OpenManage.md mdl happy

* make Dashboard.md mdl happy

* make Customizing-the-Web-UI.md as mdl happy as possible

* make Component.md mdl happy

* make Billing-Module.md mdl happy

* make Auto-Discovery.md mostly mdl happy

* make Authentication.md as mdl happy as possible

* tidy up a few lines in Applications.md

* make Agent-Setup.md as mdl happy as possible

* make metrics/OpenTSDB.md mdl happy

* spelling fix
2019-09-09 12:48:35 +02:00

1.8 KiB

source: Extensions/SNMP-Trap-Handler.md path: blob/master/doc/

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.

To enable snmptrapd to properly parse traps, we will need to add MIBs.

Make the folder /etc/systemd/system/snmptrapd.service.d/ and edit the file /etc/systemd/system/snmptrapd.service.d/mibs.conf and add the following content. You may want to tweak to add vendor directories for devices you care about (in addition to or instead of cisco).

[Service]
Environment=MIBDIRS=+/opt/librenms/mibs:/opt/librenms/mibs/cisco
Environment=MIBS=+ALL

For non-systemd systems, you can edit TRAPDOPTS in the init script in /etc/init.d/snmptrapd.

TRAPDOPTS="-Lsd -M /opt/librenms/mibs -m ALL -f -p $TRAPD_PID"

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.)

Reload service files, enable, and start the snmptrapd service:

sudo systemctl daemon-reload
sudo systemctl enable snmptrapd
sudo systemctl restart snmptrapd

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)