Hello All,

I  already implemented OID for accessing my variable .The datatype for this OID is OCTETSTRING.
I run the snmpcommands (snmpget ,snmpwalk) for getting  the string values  corresponding  for this OID variable.
After running this commands i got the output as a HEXSTRING value whose size is more than 400characters.
Also i implemented one Java program as an application programming interface consist of snmpfunctions(getMIBEntry etc.........)

import java.util.*;
import java.net.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.*;
import java.awt.event.*;
import java.io.*;
import java.math.*;
import snmp.*;
try{

String community = "public";
int version = 0; // SNMPv1

InetAddress hostAddress = InetAddress.getByName(ip.trim());

comInterface = new SNMPv1CommunicationInterface(version, hostAddress, community);

                                        String itemID = "1.3.6.1.2.1.1.3.0"
                                        System.out.println("Itemid"+itemID);
                                        SNMPVarBindList tableVars = comInterface.getMIBEntry(itemID);

                                        System.out.println("Number of table entries"+tableVars.size());
                                        for(int i=0;i<tableVars.size();i++)
                                        {
                                        SNMPSequence pair = (SNMPSequence)(tableVars.getSNMPObjectAt(i));
                                        SNMPObjectIdentifier snmpOID = (SNMPObjectIdentifier)pair.getSNMPObjectAt(0);
                                        SNMPObject snmpValue = pair.getSNMPObjectAt(1);

                                        System.out.println("Ret OID:"+snmpOID+",Type:"+snmpValue.getClass().getName()+",Value:"+snmpValue.toString());

                                        }
}

I alredy run the above code.Then the output of this progam is: Ret OID:1.3.6.1.2.1.1.3.0,Type:snmp.SNMPTimeTicks,Value:75941
But if we run the snmpcommand as "snmpget -c public -v 2c localhost .1.3.6.1.2.1.1.3.0",  i got the systemuptime  value correctly.(Timeticks: (75941) 0:18:58.21).
But if i run the above javacode i couldn't get the correct string value.Here  this code  is not taking the space character.
Please suggest any solution for this problem.
Thanks in advance
Krishnaprasad
 






   I am not aware of any limitation within the agent
regarding length.  You need to make sure that the OID
you are setting can handle a string of that size(refer
to MIB documentation).  Your handler for that OID
needs to be able to handle 400 characters (I assume
you are developing the agent code).  The default
tools(snmpset,snmpget, etc.) from the project can
handle long strings.  We have strings 1024 characters
in length.
   What types of problems are you having?

Bob

--- Krishnaprasad <[EMAIL PROTECTED]> wrote:

  
Hello All,

How can we send  a 400 character string using
snmpv1. Is it possible or
not.

Thanks in advance,

Krishnaprasad


    


DISCLAIMER:
--------------------------------------------------------------------------------------------------------------

This e-mail contains confidential and/or privileged information. If you are not the intended recipient
(or have received this e-mail in error)please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure, use or distribution of the material in this e-mail is strictly forbidden.
---------------------------------------------------------------------------------------------------------------

  


-- 
Rgds

KRISHNAPRASAD.K
R&D Engineer
HCL INFOSYSTEMS LTD
PONDICHERRY
Mob:09894530948

Reply via email to