Example: Sending Test Traps

To send an SNMP trap:
  1. From the command line, enter the following command:
    $ snmptrap -v 2c -c public localhost '' 1.3.6.1.4.1.2021.991.1.3.6.1.2.1.1.6 s \ "Device in Austin"
  2. Save this demonstration MIB into a file.
  3. Send the trap.
  4. Open the Event Console and find the trap you sent.
  5. Send this event to the event archive.
  6. Load some MIBs into the system so that this OID is translated into a better format:
    1. Copy the demonstration MIB into $ZENHOME/share/mibs/site.
    2. Run zenmib to load it:
      $ zenmib run -v 10 DEBUG:zen.zenmib:TRAP-TEST-MIB.mib INFO:zen.zenmib:Unable to find a file \ providing the MIB UCD-SNMP- MIB ...
    3. The MIB loaded, but is missing some other definitions. Copy them:
      $ cp /usr/share/snmp/mibs/SNMPv2-MIB.txt $ZENHOME/share/mibs/site \ $ cp /usr/share/snmp/mibs/UCD-SNMP-MIB.txt $ZENHOME/share/mibs/site
    4. Run zenmib again and load the definitions into the system:
      $ zenmib run -v 10
    5. Restart the zentrap daemon to retrieve the new MIB information:
      $ zentrap restart
    6. Send the trap a second time:
      $ snmptrap -v 2c -c public localhost '' 1.3.6.1.4.1.2021.13.991 .1.3.6.1.2.1.1.6 s \ "Device in Austin"
    7. Check the event. Make sure the count is 1. If the count is 2, send the event to the event archive and send the trap again. Look at the Details tab. Now you should see something like this:
      sysLocation Device in Austin

      You should also see that the event summary changes from:

      snmp trap 1.3.6.1.4.1.2021.13.991 from localhost

      to:

      snmp trap ucdExperimental from localhost