Are there version options for Indy SNMP traps?

315 views Asked by At

I'm using Embarcadero RAD Studio XE3 with its TIdSNMP Indy SNMP component to prepare and send SNMP trap notifications to an Enterprise Server. I set up to 12 varbinds depending on the trap type, and Wireshark is seeing and properly dissecting the traps on the target host. It appears that my end is working fine.

The Manager side of this system does not seem to recognize these traps and can't decode them according to the implementation team. They have pointed to the SNMP version item in the trap itself, which is 'v2u'. Because this version is deprecated, they would like to see version 'v2c', and they assert that all their other traps are this version.

The question is, do I have any options as far as what version of trap to send? I see TIdSNMP::Trap has a Version member; is it as simple as setting this to 3?

This is the code I'm using:

void SendTrap(int atcsfield)
{
    /* TIdSnmp *snmp = new TIdSNMP(0); */
    snmp->Trap->Clear();
    snmp->Trap->Version = 2;
    snmp->Trap->Community=String(cfg.snmp.community);
    snmp->Trap->TimeTicks = GetTickCount() - InitialTickCount;
    snmp->Trap->Enterprise=String(cfg.snmp.oid);
    snmp->Trap->GenTrap=6;
    snmp->Trap->SpecTrap=1;
    for(int i=0;i<MAX_VARBINDS;i++)
    {
        if(svb[i].Length())
        {
            varb.sprintf("%s.1.%d",BaseOID.c_str(),i);
            snmp->Trap->MIBAdd(varb,svb[i], ASN1_OCTSTR);
        }
    }
    for(int i=0;i<MAX_VARBINDS;i++)
    {
        if(ivb[i]!=-1)
        {
            varb.sprintf("%s.1.%d",BaseOID.c_str(),i);
            snmp->Trap->MIBAdd(varb, ivb[i], ASN1_INT);
        }
    }
    snmp->Host = ManagerIpList->Strings[j];
    snmp->SendTrap();
}
1

There are 1 answers

1
Remy Lebeau On BEST ANSWER

At this time, TIdSNMP only supports SNMPv1. Setting Trap->Version to 2 does not send a v2/v3 formatted trap, as the layout of the trap PDU is different between v1 and v2/v3.

Support for newer SNMP versions is on Indy's todo list:

Update TIdSNMP to support newer SNMP versions https://code.google.com/p/indyproject/issues/detail?id=139 http://indy.codeplex.com/workitem/19076