[SNMP4J] SNMP4J

Tejo Prayaga tejovamsi at yahoo.com
Sat Apr 22 01:11:18 CEST 2006


Hi Eduardo,

I think there are couple of options to deal with these issues:

1)
As SNMPv1 operations are atomic, the agent will not send partial results.
If your device supports SNMPv2, then you should be able to get the partial
results too.

2)
Make your management application MIB-aware and let the users enter MIB variable 
names, instead of OIDs. The application will have knowledge of all the supported
MIBs by the device and the application can at least partly validate the OID 
(leaving the instance part).

3)
If the application has to use SNMPv1 only, then the application should take care 
of re-sending GET requests with the corrected varbind list. The response sent by
the agent indicates the first problem causing OID in the list, and this OID
should be removed from the list and then a request should be sent back again.
But even this request is not guaranteed to work, because there might be other
incorrect OIDs too. The SNMP mechanism only indicates the first incorrec OID,
and there is no information about OIDs beyond the first incorrect OID.

I think there might be some other options too. Let us see if others suggest any
other additions/corrections to this list.

Regards,
Tejo


Eduardo Cardone <ecardone at hynet.com.ar> wrote: OK, I don't argue that, but in my case, it's most likely that the users
do a bad typing. So how can I do for solving this issue. More even, this
OIDs are for disk partitions, if the server administrator drop a
partition, that OID will no longer exists. So, I can't loose all the
OIDs for one that is missing. 

May be there is another aproach for handling this kind of queries.

Regards, Eduardo.- 


<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>> 
                                    Hynet S.A. 
Eduardo Cardone ecardone at hynet.com.ar
www: http://www.hynet.com.ar
Dir.: Av. Presidente Julio A. Roca 620 piso 12 
C1067ABO - Ciudad de Buenos Aires - Argentina
Tel.: 54 (11) 5128-1000
Fax: 54 (11) 5128-1001
<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>> 


-----Original Message-----
From: PHIL BERGSTRESSER [mailto:phil.bergstresser at adtran.com] 
Sent: Viernes, 21 de Abril de 2006 06:03 p.m.
To: Eduardo Cardone; snmp4j at agentpp.org
Subject: RE: [SNMP4J] SNMP4J 

That's how SNMP is defined to work.
 

-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
Behalf Of Eduardo Cardone
Sent: Friday, April 21, 2006 4:01 PM
To: snmp4j at agentpp.org
Subject: [SNMP4J] SNMP4J 

Frank, I need your help here. I need to write an application that send
to 15 devices a lot of OIDs to poll. I'm trying to send one V1 PDU to
each device with all the OIDs defined by the user. It works OK, but I
have a problem when the user put a wrong OID in the list. 

For example,
OID1= 1.3.6.1.2.1.25.2.3.1.5.1
OID2= 1.3.6.1.2.1.25.2.3.1.5.2
OID3= 1.3.6.1.2.1.25.2.3.1.5.5

But OID3 does not exist in the device.
In this example, when this happens the device return "null" for every
OID and NOT just for the wrong one.

I tryed to use GETNEXT but this command didn't return the OID that I try
to query, it return (like the name) the next element.

Can you point me any ideas?

Beste regards, Eduardo.-





<<<<<<< CODE >>>>>>>>
public void doSnmpQuery(){
    if(snmpDev != null){
      Address targetAddress =
GenericAddress.parse("udp:"+snmpDev.ipInfo.getIpAdrress()+"/"+snmpDev.sn
mpParam.puerto);
      //logger.info("Server:"+targetAddress.toString());

      CommunityTarget target = new CommunityTarget();
      target.setCommunity(new OctetString(snmpDev.snmpParam.comunidad));
      target.setAddress(targetAddress);
      target.setRetries(2);
      target.setTimeout(1000);

      //  target.setVersion(SnmpConstants.version1);
      target.setVersion(snmpDev.snmpParam.version - 1);

      TransportMapping transport;
      try{
        transport = new DefaultUdpTransportMapping();
        transport.listen();
      }catch(IOException e){
        logger.error("IOException al crear el transport",e);
        return;
      }

      Snmp snmp = new Snmp(transport);

      PDU responsePDU = null;
      responsePDU = sendSnmpQuery(target, snmpDev.oidList,snmp);
//        responsePDU = sendSnmpQuery(target,
((snmpOID)snmpDev.oidList.elementAt(i)).getOID(),snmp);

      if (responsePDU == null) {
 if (lastStatus.equals("PDU Time-out")) {
   // logger.info("Error en OID ID: "+
((snmpOID)snmpDev.oidList.elementAt(i)).getQueryID()+" -- Query Timed
out");
   lastStatus = "";
 }
      }

      if (responsePDU.getErrorStatus() > 0) {
 logger.info("Error:" + responsePDU.getErrorStatusText());
      }
      else {
 // No hubo error. Imprimo el PDU.
 logger.info("Respuesta OK:" + responsePDU.toString());
      }
    }
    return;
  }

  private PDU sendSnmpQuery(CommunityTarget target,Vector oidList,Snmp
snmp){
  // setting up target

  // creating PDU
  PDU pdu = new PDU();
  //logger.info("Cargando OID:"+oid);
  for(int i=0;i
    pdu.add(new VariableBinding(new
OID(((snmpOID)oidList.elementAt(i)).getOID())));
  }

  pdu.setType(PDU.GET);
  ResponseEvent response;
  try {
    //logger.info("Enviando PDU:"+pdu.toString());
    response = snmp.send(pdu,target);

    if (response.getResponse() == null) {
      // request timed out
      logger.error("PDU Timed-out:"+pdu.toString());
      lastStatus = "PDU Time-out";
      return null;
    }
    else {
     // logger.info("Received response from: "
+response.getPeerAddress());
      // dump response PDU
      logger.info("Respuesta OK:" + response.getResponse());
      System.out.println(response.getResponse());
      return response.getResponse();
    }
  }
  catch (IOException e) {
    logger.error("IOException al enviar el PDU", e);
    return null;
  }
}
<<<<<<< /CODE >>>>>>>>


<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>> 
                                    Hynet S.A. 
Eduardo Cardone ecardone at hynet.com.ar
www: http://www.hynet.com.ar
Dir.: Av. Presidente Julio A. Roca 620 piso 12 C1067ABO - Ciudad de
Buenos Aires - Argentina
Tel.: 54 (11) 5128-1000
Fax: 54 (11) 5128-1001
<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>> 



_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j

_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


		
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2ยข/min with Yahoo! Messenger with Voice.


More information about the SNMP4J mailing list