Question SnmpStrToOid gives me a SNMPAPI_OID_INVALID

jvanopstal

New member
Joined
Aug 8, 2008
Messages
1
Programming Experience
3-5
Hello everyone,

I'm new here, so I hope I post this question in the right forum.

A few day's ago, I got the assignment to make a little program that will communicate with some other programs at our company, and on some ocasions wil send snmp traps. So I started searching on the Internet.

First I found an example for a console application to read snmp traps with snmp-api winsnmp.dll. (c#). I converted it to vb.net and it worked great.

So I figured, I will try to send a trap with the snmp-api. This is actualy not such a difficult task. But when I try to make an OID with the SnmpStrToOid function. It always give me an SNMPAPI_OID_INVALID error.
When I go to MSDN, they tell me that this error occures when the OID string isn't correct. But I can't find a good example. On the internet i find many different oid strings.
(I use an oid wich I got from my testing application wich is Servers Alive, when testing the receiving part, I used Servers Alive to send the trap. The trap I received is the trap I'm now trying to send myself.)

.1.3.6.1.4.1.10984
1.3.6.1.4.1.10984
1.3.6.1.4.1.10984: Servers Alive
1.3.6.1.4.1.10984: Servers Alive.0

I also created some other combinations. But always with the same result.
I receive the trap (source, destination, context, id) but the trap doesn't have any OID's.

This is the OID structure
VB.NET:
    <StructLayout(LayoutKind.Sequential)> _
    Public Structure SMIOID
        Public size As UInteger
        Public dwords As IntPtr
    End Structure

And this is the original SnmpStrToOid
VB.NET:
     rc = SnmpAPI.SnmpStrToOid("1.3.6.1.4.1.10984", dTrapName)
     rc = SnmpAPI.SnmpGetLastError(rc)

I also tried other OID numbers. In case this one doesn't exsists.
No luck so far. And no good information on the internet.

Please, is there anyone out there who can help me!

Thanks.

Jan
 
Back
Top