7

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.

jishi
  • 858
  • 1
  • 11
  • 25

3 Answers3

6

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.

L.R.
  • 765
  • 6
  • 11
  • There must be something that differs in the windows version, because that exact command gives me: s: Missing type/value for variable – jishi Jun 04 '10 at 08: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 04 '10 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 05 '19 at 09:54
2

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.

0

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

Aleksandar Ivanisevic
  • 3,327
  • 19
  • 24
  • 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 03 '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 05 '10 at 17:57