Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 .1.3.6.1.4.1.5089.1.0.1 (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 192.168.100.65 '' 6 0 .1.3.6.1.4.1.5089.1.0.1 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
  • .1.3.6.1.4.1.5089.1.0.1 <- 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.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Try the following:

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

  • .1.3.6.1.4.1.5089.1.0.1 <- trap OID

  • .1.3.6.1.4.1.5089.2.0.999 <- 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
            1.3.6.1.2.1.1.3.0: 878104
            1.3.6.1.6.3.1.1.4.1.0: 1.3.6.1.4.1.5089.1.0.1 (iso.3.6.1.4.1.5089.1.0.1)
            1.3.6.1.4.1.5089.2.0.999: 31323334353 (this is 123456 octet string)

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

share|improve this answer
    
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 '10 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 '10 at 11:24

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.

share|improve this answer
    
After struggling with low-level tools, I finally managed to generate a SNMP trap that I could catch in wbemtest. Thanks for the tip! –  Cristi Diaconescu Jun 24 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

share|improve this answer
    
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 '10 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? ;) –  Aleksandar Ivanisevic Jun 5 '10 at 17:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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