I'm trying to use Net-SNMP on Windows to emulate a trap that should trigger an alarm on our surveillance system.

This is the setup:

  • Windows 7 client that sends the trap
  • Net-SNMP as software for sending the trap
  • Linux with Adventnet ManageEngine OpManager as NMS (not relevant)

This is what I'm trying to accomplish

send trap with OID . (according to the MIB I have loaded into my NMS) and just some sort of message into it to see if I can get any alarm in my NMS. I can see that I actually send a trap in my firewall, but I have no idea what it contains.

This is my attempt so far:

snmptrap.exe -v 2c -c xxxxxxx '' 6 0 . s "123456"

However, I can't seem to find any reasonable documentation with examples for snmptrap. Basically, I need to know what:

  • '' <- why do I need this? I can omit it and it will still send a trap
  • 6 <- Enterprise gneric trap, I assume. Is this correct?
  • 0 <- I have no idea, I need some sort of value for this
  • . <- the enterprise specific OID I assume, should this be followed by some more numbers
  • s <- indicates string
  • "123456" <- just a random test-string...

This doesn't make much sense to me, and if anyone can shed some light on this I would be very grateful.

3 Answers 3


Try the following:

snmptrap.exe -v 2c -c xxxxxxx 
'' . . s "123456"
  • '' <- the first parameter for v2c trap is the agent uptime, it is mandatory and empty parameter will be replaced with current value

  • . <- trap OID

  • . <- varbind (this needs to be defined as a string value in MIB)

  • s <- indicates string

  • "123456" <- just a random test-string...

This generates a SNMPv2c trap with the following content (as seen in wireshark):

      variable-bindings: 3 items
   31323334353 (this is 123456 octet string)

This output comes from snmptrap on Linux, but it seems to be the same as on Windows.

  • There must be something that differs in the windows version, because that exact command gives me: s: Missing type/value for variable
    – jishi
    Jun 4, 2010 at 8:41
  • 1
    Okay, I figured it out that the windows version doesn't support the '' notation for "current uptime", but seems to demand a value.
    – jishi
    Jun 4, 2010 at 11:24
  • 1
    Works fine also on Debian Linux. I've got an old Asterisk box which sometimes gets overloaded and needed to send appropriate strings to my snmptrap server.
    – Laz
    Jun 5, 2019 at 9:54

Man forget the Net- SNMP there is to much hassle using it ... just download MIB browser from http://ireasoning.com/mibbrowser.shtml ... load up a mib file and u could see and send all SNMP traps.

  • After struggling with low-level tools, I finally managed to generate a SNMP trap that I could catch in wbemtest. Thanks for the tip! Jun 24, 2014 at 11:43

i also dont understand it fully, but this works for me (trial and error method ;)

snmptrap -v 2c -Ci -u user -c community host '' .x.y.z.q.oid 1 s string 2 s string2

  • Without explanation of what 1 and 2 is in that example, it doesn't make any sense at all to me...? And with your example, I get this reply: s: ("1") and no trap is sent over the network.
    – jishi
    Jun 3, 2010 at 16:10
  • 1 and 2 are the first and second value in a trap. This works with linux net-snmp's snmptrapd as receiver. If you got a reply, who sent it if nothing is sent over a network? ;) Jun 5, 2010 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.