How do I set up SNMP Generic Trap monitors?

What is correct procedure of setting SNMP Custom Trap monitor?

Q: Having problems getting SNMP traps to work. The monitor does not change its state from Unknown, no matter what OID is specified. I have tested with a general trap manager and the traps being generated by device I need to monitor. How do I handle this?

A: Please ensure you check the following steps when using SNMP Generic Trap monitors in IPHost:

Make sure IPHost listens for incoming traps

Start IPHost GUI client and proceed to “Settings -> System”. Please pay attention to UDP port IPHost uses to listen to SNMP traps (“SNMP traps receiver UDP port” value). Default port is 162, but if Windows already has SNMP service running, IPHost might select different port.

Open cmd.exe (Run as Administrator) and run command

netstat -anb

and look through its output for lines like

  UDP    0.0.0.0:162            *:*
 [NMSService.exe]

(in your case, the port (162) should match the one you see in “Settings -> System” in IPHost GUI client)

The above would mean IPHost is listening for SNMP traps.

Please make sure Windows firewall (or 3-rd party firewall/network security tool) doesn’t block access for incoming UDP connections to SNMP trap port IPHost uses.

Set up test SNMP Generic Trap monitor to check

When setting up SNMP Generic Trap monitor, make sure it accepts all communities and all OIDs (i.e., it will receive any trap), that makes easier setting up SNMP trap monitors. In monitor Main parameters select:

  • SNMP Trap type: Custom trap
  • SNMP Trap OID: enter nothing, check “Accept any”
  • Community string: enter nothing, check “Accept any”

Make sure you create SNMP Generic Trap monitor exactly for the host you expect sending traps from. Pay attention to its IP address (displayed after host name in Main parameters’ header)

Set email alert for the trap: it will list all trap data received, it will make debugging simpler.

On the remote device that should send trap, make sure you set proper IP and UDP port of trap receiver (IP of the computer running IPHost and correct UDP port, the one IPHost actually uses to listen to traps).

If nothing else helps, emulate sending traps

If it can’t be sure whether the device does actually send SNMP Trap, use Net-SNMP package to test. Install the latest binaries downloaded from the above site and use supplied snmptrap utility to emulate sending traps (the sample command below assumes you have installed the Net-SNMP package using default settings):

c:\usr\bin\snmptrap.exe -v 2c -c public 127.0.0.1:163 "" 1.3.6 1.1.2.5 s "Test"

    The above command, when run on the computer running IPHost monitor, sends SNMP Trap as follows:

    • sends to host 127.0.0.1 (always created when installing IPHost) and UDP port 163 (use actual port number taken at step 1 above)
    • version 2c of SNMP protocol is used and SNMP community ‘public’
    • OID 1.3.6 sends the trap
    • additional variable (payload) is added to trap: string “Test” sent on behalf of OID 1.1.2.5

    Note: to see IPHost responding to the trap sending command above, create SNMP Generic Trap for host 127.0.0.1 as explained in the beginning of previous section.

    Note: stop and start SNMP Generic Trap monitor before re-attempting to test its connectivity. If the trap is caught, monitor will go green.

    When you managed to have SNMP Trap monitor go to “OK” (green) state, use the collected parameters to set up proper SNMP monitor.

    Related topics

    How to make sure SNMP trap works as expected?