Hello everyone,
I'm trying to add a parameter to customize the port to send traps in the Generic Trap Forwarder controller. I'm using the DMS_SNMP_NOTIFICATION (73) guide to build the GeneralInfo array and send all the information in a proper way but currently it's just working when I use the default port (162).
Hi Sebastiam,
I performed a small test and I was able to send a trap to a different port.
Below a excerpt of the QAction that takes care of preparing the generalInfo parameter for a SNMPv1 trap. In this case I used the port 10162:
olGeneralInfo.Add(iElementId);
olGeneralInfo.Add(0); /*Parameter ID: Obsolete*/
olGeneralInfo.Add(sTrapDestination); /*Trap Destination (IP Address)*/
olGeneralInfo.Add(COMMUNITY_STRING); /*Community String*/
olGeneralInfo.Add(ENTERPRISE_OID); /*Obsolete*/
olGeneralInfo.Add(sIpAddress); /*Source Address*/
olGeneralInfo.Add(10162); /*Destination port*/
olGeneralInfo.Add(0); /*Code Page: ANSI*/
For SNMPv2 traps:
olGeneralInfo.Add(iElementId);
olGeneralInfo.Add(0); /*Parameter ID: Obsolete*/
olGeneralInfo.Add(sTrapDestination); /*Trap Destination (IP Address)*/
olGeneralInfo.Add(COMMUNITY_STRING); /*Community String*/
olGeneralInfo.Add(string.Empty); /*Enterprise OID: Obsolete*/
olGeneralInfo.Add(10162); /*Destination port*/
olGeneralInfo.Add(0); /*Code Page: ANSI*/
olGeneralInfo.Add(false); /*SysUp binding*/
olGeneralInfo.Add(string.Empty); /*Trap OID Binding*/
olGeneralInfo.Add(30000); /*Timeout time (ms)*/
olGeneralInfo.Add(20); /*Retries*/
Hope it helps!
Hi Sebastiam,
I updated my answer with an example for SNMPv2 trap. I tested it as well and I was able to send a SNMPv2 trap to port 10162
Hi Miguel,
Your help was very usefull, it is working now, thank you!
Hello Miguel,
First of all thanks for your help. I have a doubt, the format used in this particular case should be for SNMPv2, is there anything else to take into account apart from the format of the GeneralInfo array?