[SNMP4J] Sending an object identifier

Gian Marco Gallo gianmarco.gallo at elaide.com
Tue Jun 29 12:39:12 CEST 2010


  Good day

I'm trying to send a notification with snmp4j and to add informations in 
my pdu (so the mib in the server can print the right message in the 
server log). So I've tried this:


         pdu = new PDU();
         pdu.setType(PDU.TRAP);
         pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new 
OctetString("UCD-NOTIFICATION-TEST-MIB::demoNotif")));

But in the server log appears this:

Jun 29 12:30:14 qa1 snmptrapd[6166]: 2010-06-29 12:30:14 luna.elaide.com 
[UDP: [192.168.5.19]:48917]: SNMPv2-MIB::snmpTrapOID.0 = Wrong Type 
(should be OBJECT IDENTIFIER): STRING: 
"UCD-NOTIFICATION-TEST-MIB::demoNotif"

Any idea on how send an object identifier?
This is the mib on the server:

UCD-NOTIFICATION-TEST-MIB DEFINITIONS ::= BEGIN
        IMPORTS ucdExperimental FROM UCD-SNMP-MIB;

  ucdNotificationTestMib MODULE-IDENTITY


  demotraps  OBJECT IDENTIFIER ::= { ucdExperimental 990 }
  demonotifs OBJECT IDENTIFIER ::= { demotraps 0 }

  *demoNotif*  NOTIFICATION-TYPE
        OBJECTS { sysLocation }
        STATUS current
        DESCRIPTION "An example of an SMIv2 notification"
        *::= { demonotifs 18 }*

  ucdNotificationGroup NOTIFICATION-GROUP

  END

Thanks in advance


-- 
Gian Marco Gallo
Elaide SRL

Email: gianmarco.gallo at elaide.com
Phone: +39 049 4102390




More information about the SNMP4J mailing list