Trying to send an SNMP trap to a device from a QAction:
IDMS dms = new DMS();
string ip = "172.30.149.242";
object[] general = { protocol.ElementID, -1, pollingIp, "public", "" };
object[] bindings =
{
new object[] { "1.3.6.1.6.3.1.1.4.1.0", "1.3.6.1.4.1.2509.5.5.1.4.4", "OID" },
new object[] { "1.3.6.1.4.1.2509.5.5.1.5.1", ip, "IpAddress" },
new object[] { "1.3.6.1.4.1.2509.5.5.1.5.2", "1", "Integer" },
};
dms.Notify(73 /*DMS_SNMP_NOTIFICATION*/, 22, general, bindings, out object _);
Using wireshark, it can be seen that the IpAddress field is read as an OctetString, resulting in the device not responding to the trap.
I've looked through the docs and "IpAddress" is supposed to be an accepted SNMP Type, so not sure why it isn't working.
How can I fix this?
As a secondary question, since dms.Notify is obsolete, what is the equivalent method in the Class Library for sending SNMP traps?
Hi Joshua,
Checking this link, the type ipAddress is supported only on SMIv1. Checking this other link, it seems that this type is only available for SNMPv1.
Checking your code, you are trying to send a SNMPv2 trap. Can you change it to SNMPv1 (messageType=21)?
Hope it helps.
Hi Miguel, thanks for the reply. I tried using SNMPv1 to send the message but I wasn’t successful in even sending the message (so no wireshark entry was seen).
I am also a little doubtful that this might be the issue as I was able to use the “IpAddress” type to send the SNMPv2 trap when using the iReasoning MIB Browser tool.
Hi Joshua,
Indeed, It seems that this is a bug. There is already a RN that tackles this issue (see RN39425)
Hi Joshua,
Could you provide a little bit more information about your use case?
Normally a SNMP trap is received from a device, and not being sent to a device.