Skip to content

Example: Sending test traps

To send an SNMP trap:

  1. As root, attach to the zope service.

    serviced service attach zope/0
    
  2. 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"
    
  3. Save this demonstration MIB into a file.

  4. Send the trap.

  5. Open the Event Console and find the trap you sent.

  6. Send this event to the event archive.

  7. Load some MIBs into the system so that this OID is translated into a better format. As a pre-requisite to this procedure, see Administering MIB files.

    1. Copy the demonstration MIB into /opt/serviced/var/volumes/<instance_id>/zenoss-var-ext/uploadedMIBs.

    2. Run the following command:

      serviced service run zope zenmib run -v10 \
        /opt/zenoss/var/ext/uploadedMIBs/<MIB_filename> \
        --path=/<device_class> --removemiddlezeros \
        --mibdepsdir=/opt/zenoss/var/ext/uploadedMIBs
      

      The --removemiddlezeros flag is needed when MIBs use notification OIDs with embedded zeros.

    3. 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"
      
    4. 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