[AGENT++] RE: Notification OID Error
BalaSubrahmanyam Gattu
bgattu at sta.samsung.com
Sun Sep 14 04:35:09 CEST 2003
Hi,
Please ignore my previous mail. It is solved.
I faced this error because of two reasons first one I have used variable
OID as "4.0". After reading the David Pekins's SNMP Mib's I learned that
variable Oid can start with 0 or 1 or 2.
Second one is I was using V1 notification where as I wanted V2c.
Now it is working fine.
Thanks,
Bala
> -----Original Message-----
> From: BalaSubrahmanyam Gattu
> Sent: Friday, September 12, 2003 7:15 PM
> To: 'agentpp at agentpp.org'
> Subject: Notification OID Error
>
> Hi,
>
> I am trying to make a simple notification agent.
>
> I am getting invalid OID's for the variables at the manager. At agent
> if I print all the trap VBs all the OID's are printing properly. If I use
> hardcoded OID values like "1.2.3" they are reaching manager properly.
>
> Can you kindly advise me in this regard.
>
> I get data as unsigned char *payload and variables information in tVar
> structure. I am preparing the variable binds like following:
>
> Oid notifOid("1.2.3.4.0.5");
>
> Vbx *vb;
> vb = new Vbx[tInfo.numOfFields]; //Assign memory to variable binds
>
> //In loop prepare notification variable bind information
> for(int fCount=0; fCount < tInfo->numOfFields; fCount++)
> {
>
> //Set the OID for each of the variable
> Oid *vOidPtr = new Oid(tInfo->tVar[fCount].vOid);
> vb[fCount].set_oid(*vOidPtr);
>
> bufPtr = payload+tInfo->tVar[fCount].memStartPos;
>
> //Set the Value for each of the variable
> switch(tInfo->tVar[fCount].type)
> {
> case ASN_INTEGER: //(0x02) or Integer32
> {
> long lVal;
> memcpy(&lVal, bufPtr, sizeof(long));
> SnmpInt32 *int32Ptr = new SnmpInt32(lVal);
> vb[fCount].set_value(*int32Ptr);
> }
> break;
> case ASN_OCTET_STR: //(0x04)
> {
> OctetStr *octetPtr = new OctetStr((unsigned char *)bufPtr,
> (unsigned long) tInfo->tVar[fCount].dimension);
> vb[fCount].set_value(*octetPtr);
> }
> break;
>
> case ASN_OBJECT_ID: //(0x06)
> {
> Oid *oidPtr = new Oid((const char *)bufPtr);
> vb[fCount].set_value(*oidPtr);
> }
> break;
>
> //Send the notification
> _notifOriginator.generate(vb, tInfo.numOfFields, notifOid, "", "");
>
> //Delete memory
> delete[] vb;
>
> Thanks in advance.
>
> With Best Regards,
> Bala
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.agentpp.org/pipermail/agentpp/attachments/20030913/2c67a9de/attachment.htm
More information about the AGENTPP
mailing list