SNMP Notes

Table of Contents

1 Basics of snmptrapd

  1. Disable authorization

    The first thing I would like to do if I were you is to disable authorization. Otherwise, you may see a warning like the following example demonstrates and no message will be printed even when traps come in (because they are dropped silently).

    # snmptrapd -f -Lo -m all -Os
    Warning: no access control information configured.
    This receiver will *NOT* accept any incoming notifications.
    NET-SNMP version 5.5
    

    This because, starting with release 5.3, access control checks will be applied to incoming notifications.

    To disable it, append the following line to /etc/snmp/snmptrapd.conf:

    disableAuthorization yes
    
  2. Load "non-standard" MIB files

    This is achieved by -M. For example:

    snmptrapd -f -Lo -m all -Os -M +/abs/path/to/dir1:/abs/path/to/dir2
    
  3. Dump received traps in hex

    Add -d, i.e.

    snmptrapd -f -Lo -m all -Os -d
    

    This is useful when you don't have dependant MIB files since this way you can at least take a peek at the message received.

  4. Output format

    Replace -Os in previous examples with -OS to print MIB module id. Use -Of instead to print full oids on output. For more output format options, please refer to manual.

  5. Capture SNMP packets

    Though this is not part of snmptrapd, here it is anyway.

    tshark -f "udp port 162" -c 2 -w snmp.pcap -i lo
    

Created: 2016-01-11 Mon 10:19 by Emacs 24.5.1 (Org mode 8.2.10)

comments powered by Disqus