[SNMP4J] SNMP v1 Traps

Frank Fock fock at agentpp.com
Sun Feb 20 11:30:02 CET 2005


Steven,

I cannot reproduce the problem. SNMPv1 traps con be received
without any problems (including variable bindings and trap types).
However, the PDUv1.toString() method does not currently overwrite
PDU.toString(). As a consequence, the SNMPv1 trap specific
members are not printed out. The following code which should be
added to the PDUv1 class corrects this:

  public String toString() {
    StringBuffer buf = new StringBuffer();
    buf.append(getTypeString(type));
    buf.append("[reqestID=");
    buf.append(requestID);
    buf.append(", timestamp=");
    buf.append(timestamp);
    buf.append(", enterprise=");
    buf.append(enterprise);
    buf.append(", genericTrap=");
    buf.append(genericTrap);
    buf.append(", specificTrap=");
    buf.append(specificTrap);
    buf.append(", VBS[");
    for (int i=0; i<variableBindings.size(); i++) {
      buf.append(variableBindings.get(i));
      if (i+1 < variableBindings.size()) {
        buf.append("; ");
      }
    }
    buf.append("]]");
    return buf.toString();
  }

To analyze your trap receiving problem, it may be helpful to post
the packet content here (the content should have been printed
out in DEBUG logging mode by the TransportMapping).

Thanks,
Frank


Moyer, Steven wrote:

>Frank:
>
>There is no error message ... but there are also no varbinds in the Vector 
>returned by the getVariableBindings method.  I know that they're included in 
>the packets (I sniffed them off the wire).
>
>It is also unclear to me where I should be looking for the trap-generic, 
>trap-specific and enterprise information.
>
>Any help (or examples) would be greatly appreciated (though the SnmpRequest 
>application also doesn't retrieve v1 varbinds or parameters).
>
>Thanks, Steve
>
>On Thursday 17 February 2005 05:53 pm, Frank Fock wrote:
>  
>
>>Steven,
>>
>>What is the error message you get? I cannot reproduce the problem.
>>
>>Thanks,
>>Frank
>>
>>Moyer, Steven wrote:
>>    
>>
>>>I have created a small test system for gathering traps.  It appears
>>>      
>>>
>>that SNMP
>>
>>    
>>
>>>v1 traps don't pass in the Trap-Specific, Trap-Generic or Enterprise
>>>parameters.  I also don't seem to be able to get the varbinds.  Am I
>>>      
>>>
>>doing
>>
>>    
>>
>>>something wrong?
>>>      
>>>
>
>  
>





More information about the SNMP4J mailing list