Template:FAQ:Applications 17

From Net-SNMP Wiki
Revision as of 10:28, 28 May 2009 by Dts12 (Talk | contribs) (Latest FAQ revision - preparing for 5.5 release)

Jump to: navigation, search

Handling incoming traps is the job of a "notification receiver". The Net-SNMP suite include the tool 'snmptrapd' to act in this role. This can log traps to a file or via the syslog mechanism, forward them to another notification receiver and/or invoke a specified command whenever a particular notification is received.

Logging notifications would be done by starting snmptrapd as:

       snmptrapd -Ls 7         (log to 'LOCAL7')
           (log to syslog using 'LOCAL7')

or

       snmptrapd -f -Lo
           (log to standard output)

Invoking a command to process a received notification uses one or more 'traphandle' directives in the configuration file 'snmptrapd.conf'. A typical configuration might look something like:

       traphandle .1.3.6.1.6.3.1.5.1       /path/to/page_me up
       traphandle .1.3.6.1.4.1.2021.251.1  /path/to/page_me up
       traphandle .1.3.6.1.4.1.2021.251.2  /path/to/page_me down
       traphandle default                  /path/to/log_it

where 'page_me' and 'log_it' are the command to be run.

Forwarding notifications to another receiver would be done using similar 'snmptrapd.conf' directives:

       forward .1.3.6.1.4.1.8072.4.0.3  10.0.0.1
       forward default                  10.0.0.2

There's a tutorial with more details on the web site at http://www.net-snmp.org/tutorial-5/commands/snmptrap.html