Ho to decrypt snmp log using Snmp4j

Hi all
I have problem with decoding snmp log using my own listener.
From the sample inside the snmp4j source code, what i can see here is we have to use their listener.
Because of this, the snmp4j listener cannot bind the port 162 because my program has bound it.
What is another way for me to get the the real snmp log(not encrypted).
Below are the code of my snmparser that has problem to bind the port
public class SnmpParser extends Parser implements CommandResponder {
private String[] data = (String[]) COLUMN_DEFAULT_VALUE.clone();
private String strLog = "";
private String strIP = "";
private MultiThreadedMessageDispatcher dispatcher;
private Snmp snmp = null;
private Address listenAddress;
private ThreadPool threadPool;
private int n = 0;
private long start = -1;
private ByteBuffer bis = null;
private TransportMapping transport = null;
public SnmpParser(String strIP, String strRawlog) {
this.strIP = strIP;
strLog = strRawlog;
private void init() throws UnknownHostException, IOException {
threadPool = ThreadPool.create("Trap", 2);
dispatcher =
new MultiThreadedMessageDispatcher(threadPool,
new MessageDispatcherImpl());
listenAddress =
GenericAddress.parse(System.getProperty("snmp4j.listenAddress",
"udp:192.168.2.55/162")); //This 162 port caused proggram terminated because cannot bind
if (listenAddress instanceof UdpAddress) {
transport = new DefaultUdpTransportMapping((UdpAddress)listenAddress);
else {
transport = new DefaultTcpTransportMapping((TcpAddress)listenAddress);
snmp = new Snmp(dispatcher,transport);
snmp.getMessageDispatcher().addMessageProcessingModel(new MPv1());
snmp.getMessageDispatcher().addMessageProcessingModel(new MPv2c());
snmp.getMessageDispatcher().addMessageProcessingModel(new MPv3());
USM usm = new USM(SecurityProtocols.getInstance(),
new OctetString(MPv3.createLocalEngineID()), 0);
SecurityModels.getInstance().addSecurityModel(usm);
// snmp.listen();
public void doConvert() {
System.out.println("Rawlog : " strLog);
+//System.out.println("Rawlog(hex) : "+ new OctetString(strLog).toHexString());
try {
init();
snmp.addCommandResponder(this);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//fire ProcessMessage
bis = ByteBuffer.wrap(strLog.getBytes());
try {
if(transport!=null) {
((DefaultUdpTransportMapping)transport).fireProcessMessage(new UdpAddress(InetAddress.getByName("192.168.2.55"),
162), bis);
System.out.println("Firing");
} else {
System.out.println("Not firing");
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public void processPdu(CommandResponderEvent event) {
System.out.println(event.getPDU());
System.out.println(event.getPDU().getVariableBindings());
System.out.println(event.getPDU().getType());
Below is just my listener code
public final class UDPListener extends Listener {
private int iUDPPort = 0;
private boolean bStop = false;
private byte[] buffer = null;
private DatagramSocket dSocket = null;
private DatagramPacket dPacket = null;
public UDPListener(int piUDPPort) {
this.iUDPPort = piUDPPort;
this.buffer = new byte[1024];
private boolean exceptionCaught = false;
public UDPListener(int piUPDPort, int piBufferSize) {
this.iUDPPort = piUPDPort;
this.buffer = new byte[piBufferSize];
public void run() {
// if UDP listener initialized successfully, proceed with listening
// or else exit this thread
if (initUDPListener()) {
Indefinite loop while bStop remains false. bStop is only set in 2 places.
1. when stopListener method is called
*2. when an exception is encountered in the block*
while (!bStop) {
try {
dSocket.receive(dPacket);
extractLog();
} catch (Exception e) {
Signifying exception is caught. Ending loop
Logger.getLogger(UDPListener.class).error("Error while listening to UDP port: " + iUDPPort, e);
exceptionCaught = true;
bStop = true;
try {
if (dSocket != null)
dSocket.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (exceptionCaught)
ListenerThreadReviver.getInstance().reinitListener("UDP", iUDPPort);
Logger.getLogger(UDPListener.class).debug("UDPListener exiting gracefully");
private void extractLog() {
String strLog = "";
String strDeviceIP = "";
strLog = new String(dPacket.getData(), 0, dPacket.getLength());
strDeviceIP = dPacket.getAddress().toString().replace("/", "");
processLog(strLog, strDeviceIP);
dPacket.setLength(buffer.length);
private boolean initUDPListener() {
try {
// constructs a datagram socket and binds it to the specified port on the local host machine
dSocket = new DatagramSocket(iUDPPort);
// constructs a new datagram packet for receiving packets
dPacket = new DatagramPacket(buffer, buffer.length);
catch (SocketException e)
// if the socket could not be opened, or the socket could not bind to the specified local port.
e.printStackTrace();
// attempts to close dSocket if it is open
if (dSocket != null && !dSocket.isClosed()) {
dSocket.close();
// returns false to indicate initialization failure
return false;
return true;
public synchronized void stopListener() {
bStop = true;
dSocket.close();
-----

instead of using  SNMPv2-SMI::mib-2.16.19.12.0  use the actual OID.
i believe you can set it like this ipRouteNextHop.0.0.0.0 a X.X.X.X
http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?objectInput=.1.3.6.1.2.1.4.21.1.7+&translate=Translate&submitValue=SUBMIT

Similar Messages

  • Writing SNMP Manager using SNMP4J

    Hello,
    I am writing a SNMP Manager that is supposed to do the following:
    (1) Send snmp commands to snmp-agents, and handle thier response.
    (2) receive snmp traps from snmp-agents.
    I am using SNMP4J software package for writing the snmp manager.
    I would like to use a SINGLE Snmp object (SNMP4J object) , both
    for sending a snmp command and for receiving snmp traps.
    SO far, I have written two separate programs:
    *** Program 1:
    ** The first program only listens for Snmp trap-PDUs.
    ** Its main code is as follows:
         // configure Snmp object
         UdpAddress address = new UdpAddress("127.0.0.1/1990");
         TransportMapping transport = new DefaultUdpTransportMapping(address);
         Snmp snmp = new Snmp(transport);
         transport.listen();
         // handle received traps here
         CommandResponder trapPrinter = new CommandResponder() {
              public synchronized void processPdu(CommandResponderEvent e) {
                   PDU command = e.getPdu();
                   if (command != null) {
                        System.out.println(command.toString());
         snmp.addCommandResponder(trapPrinter);
    *** Program 2:
    ** The second program sends GET PDUs, and its main code is as follows:
         // configure Snmp object
         UdpAddress targetAddress = new UdpAddress("127.0.0.1/1985");
         CommunityTarget target = new CommunityTarget();
         target.setCommunity(new OctetString("public"));
         target.setAddress(targetAddress);
         target.setRetries(2);
         target.setTimeout(10000); // was 1000 !!!
         target.setVersion(SnmpConstants.version1);
         Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
         snmp.listen();
         // prepare the PDU for sending
         PDU command = new PDU();
         command.setType(PDU.GET);
         command.add(new VariableBinding(new OID("1.3.6.1.4.1.1331.11.5.1.0")));
         // now send the PDU
         ResponseEvent responseEvent = snmp.send(pdu, target);
         if (responseEvent != null)
              // response has arrived. handle it
         else
              System.out.println("null response received...");
    I would like to unite these two programs into one, however, I cannot seem to
    properly allocate one Snmp object to handle both the sending and receiving of PDUs.
    I run two threads: thread-1 that does the listening for snmp traps,
    and thread-2 which in charge of sending get/set PDUs.
    I allocate the Snmp object in one place as follows:
         TransportMapping transport = new DefaultUdpTransportMapping(new UdpAddress("127.0.0.1/1990"));
         Snmp snmp = new Snmp(transport);
         snmp.listen();
    and I transfer it to both threads to be used there.
    However, thread-2 sometimes fails to send PDUs using snmp.send(...);
    What am I doing wrong?
    Can anyone guide me as for how I should allocate the Snmp object so
    it is good for both sending PDUs, and for receving traps?
    Thanks,
    Nefi

    Hello,
    I am writing a SNMP Manager that is supposed to do the following:
    (1) Send snmp commands to snmp-agents, and handle thier response.
    (2) receive snmp traps from snmp-agents.
    I am using SNMP4J software package for writing the snmp manager.
    I would like to use a SINGLE Snmp object (SNMP4J object) , both
    for sending a snmp command and for receiving snmp traps.
    SO far, I have written two separate programs:
    *** Program 1:
    ** The first program only listens for Snmp trap-PDUs.
    ** Its main code is as follows:
         // configure Snmp object
         UdpAddress address = new UdpAddress("127.0.0.1/1990");
         TransportMapping transport = new DefaultUdpTransportMapping(address);
         Snmp snmp = new Snmp(transport);
         transport.listen();
         // handle received traps here
         CommandResponder trapPrinter = new CommandResponder() {
              public synchronized void processPdu(CommandResponderEvent e) {
                   PDU command = e.getPdu();
                   if (command != null) {
                        System.out.println(command.toString());
         snmp.addCommandResponder(trapPrinter);
    *** Program 2:
    ** The second program sends GET PDUs, and its main code is as follows:
         // configure Snmp object
         UdpAddress targetAddress = new UdpAddress("127.0.0.1/1985");
         CommunityTarget target = new CommunityTarget();
         target.setCommunity(new OctetString("public"));
         target.setAddress(targetAddress);
         target.setRetries(2);
         target.setTimeout(10000); // was 1000 !!!
         target.setVersion(SnmpConstants.version1);
         Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
         snmp.listen();
         // prepare the PDU for sending
         PDU command = new PDU();
         command.setType(PDU.GET);
         command.add(new VariableBinding(new OID("1.3.6.1.4.1.1331.11.5.1.0")));
         // now send the PDU
         ResponseEvent responseEvent = snmp.send(pdu, target);
         if (responseEvent != null)
              // response has arrived. handle it
         else
              System.out.println("null response received...");
    I would like to unite these two programs into one, however, I cannot seem to
    properly allocate one Snmp object to handle both the sending and receiving of PDUs.
    I run two threads: thread-1 that does the listening for snmp traps,
    and thread-2 which in charge of sending get/set PDUs.
    I allocate the Snmp object in one place as follows:
         TransportMapping transport = new DefaultUdpTransportMapping(new UdpAddress("127.0.0.1/1990"));
         Snmp snmp = new Snmp(transport);
         snmp.listen();
    and I transfer it to both threads to be used there.
    However, thread-2 sometimes fails to send PDUs using snmp.send(...);
    What am I doing wrong?
    Can anyone guide me as for how I should allocate the Snmp object so
    it is good for both sending PDUs, and for receving traps?
    Thanks,
    Nefi

  • Problem in implementing code using snmp4j.jar

    Hi,
    I am using snmp4j.jar to create a class that will execute SNMP commands such as GET, GETNEXT and GETTABLE.
    The issue I am facing is extremely peculiar. When running the program for the first time, the output is seen correctly. However, in the subsequent executions, the program hangs (at the point where the object of my snmp class is to be created).
    I am unable to understand if some socket/port has been left open in the first run because of which successive executions are not happening. Also, the SNMP session may not be getting closed properly.
    Could someone please help me out with this issue? I am pasting the code snippets here for reference.
    Please do respond with your comments on the same. Thank you.
    import java.io.IOException;
    import java.util.List;
    import java.util.Vector;
    import org.snmp4j.CommunityTarget;
    import org.snmp4j.PDU;
    import org.snmp4j.Snmp;
    import org.snmp4j.event.ResponseEvent;
    import org.snmp4j.mp.SnmpConstants;
    import org.snmp4j.smi.Address;
    import org.snmp4j.smi.GenericAddress;
    import org.snmp4j.smi.OID;
    import org.snmp4j.smi.OctetString;
    import org.snmp4j.smi.VariableBinding;
    import org.snmp4j.transport.DefaultUdpTransportMapping;
    import org.snmp4j.util.DefaultPDUFactory;
    import org.snmp4j.util.TableEvent;
    import org.snmp4j.util.TableUtils;
    public class MySNMP
          *  Class variable declarations
         PDU requestPDU = null;
         Snmp snmp = null;
         CommunityTarget target = null;
         String responseString = null;
          *  Main method; point of execution start.
         public static void main(String[] args) throws IOException
                   snmpUtils obj = new snmpUtils("XX.XX.XX.XX", "public", 1, 1500);
                   String arrGet = obj.snmpGet(".1.3.6.1.2.1.1.1.0");
                   System.out.println("\nGET RESPONSE");
                   System.out.println(arrGet);
                   String arrGetNext = obj.snmpGetNext(".1.3.6.1.2.1.1.1.0");
                   System.out.println("\nGETNEXT RESPONSE");
                   System.out.println(arrGetNext);
                   String[] arr = { ".1.3.6.1.2.1.2.2.1.1.", ".1.3.6.1.2.1.2.2.1.5" };
                   String arrGetTable = obj.snmpGetTable(arr);
                   System.out.println("\nGETTABLE RESPONSE");
                   System.out.println(arrGetTable);
          *  Parameterized constructor
         public MySNMP(String IP, String commString, int version, long timeout)
              // Create an instance of the Snmp class, CommunityTarget class
              try
                   snmp = new Snmp(new DefaultUdpTransportMapping());
              catch (IOException e)
                   e.printStackTrace();
              target = new CommunityTarget();
              Address targetAddress = GenericAddress.parse("udp:" + IP + "/161");
              // Set the address of the target device; This is a mandatory value to be passed by the calling script
              target.setAddress(targetAddress);
               *  Set the version of the target device;
               *  In cases where the version provided is not 1,2 or 3, the default value set is 1 
              if (version == 1)
                   target.setVersion(SnmpConstants.version1);
              else if (version == 2)
                   target.setVersion(SnmpConstants.version2c);
              else if (version == 3)
                   target.setVersion(SnmpConstants.version3);
              // Set the timeout of the target device
              target.setTimeout(timeout);
               *  Set the community string of the target device;
               *  In cases where the community string provided is not null, the default value is set as "public" 
              if (commString == null)
                   target.setCommunity(new OctetString("public"));
              else
                   target.setCommunity(new OctetString(commString));          
          *  SNMP get/getNext operation logic
         public void get(String oid, int pduType) 
              // Create a PDU with the OID and type
              requestPDU = new PDU();
              requestPDU.add(new VariableBinding(new OID(oid)));
              requestPDU.setType(pduType);
              ResponseEvent response = null;
              try
                   // Invoke the listen() method on the Snmp object
                   snmp.listen();
                   // Send the PDU constructed, to the target
                   response = snmp.send(requestPDU, target);
              catch (IOException e)
                   e.printStackTrace();
              // Retrieve the response details and put into an array called "responseArray"
              responseString = new String();
              if (!(response.getResponse() == null))
                   //Extract the response
          *  SNMP GET method API
         public String snmpGet(String oid)
              get(oid, PDU.GET);
              return(responseString);          
          *  SNMP GETNEXT method API
         public String snmpGetNext(String oid) throws IOException
              get(oid, PDU.GETNEXT);
              return(responseString);     
          *  SNMP getTable operation
         public String snmpGetTable(String[] oid)
              // Invoke the listen() method on the Snmp object
              try
                   snmp.listen();
              catch (IOException e)
                   e.printStackTrace();
              // Create a TableUtils
              TableUtils utils = new TableUtils(snmp, new DefaultPDUFactory());
              // Set the lower/upper bounds for the table operation
              OID lowerIndex = null;
              OID upperIndex = null;
              // Create an array of the OID's that need to be checked
              OID[] arr = new OID[oid.length];
              for (int i=0; i<oid.length; i++)
                   arr[i] = new OID(oid);
              // Transfer output to a data structure
              List list = utils.getTable(target, arr, lowerIndex, upperIndex);
              // Dump the response into an array called "responseArray"
              return responseString;

    Hi
    I did some changes in the code and i invoked this for many times it still gives some response to me.
    This program is not hanging.
    import java.io.IOException;
    import java.util.List;
    import org.snmp4j.CommunityTarget;
    import org.snmp4j.PDU;
    import org.snmp4j.Snmp;
    import org.snmp4j.event.ResponseEvent;
    import org.snmp4j.mp.SnmpConstants;
    import org.snmp4j.smi.Address;
    import org.snmp4j.smi.GenericAddress;
    import org.snmp4j.smi.OID;
    import org.snmp4j.smi.OctetString;
    import org.snmp4j.smi.VariableBinding;
    import org.snmp4j.transport.DefaultUdpTransportMapping;
    import org.snmp4j.util.DefaultPDUFactory;
    import org.snmp4j.util.TableUtils;
    public class MySNMP
          *  Class variable declarations
         PDU requestPDU = null;
         Snmp snmp = null;
         CommunityTarget target = null;
         String responseString = null;
         public MySNMP()
          *  Main method; point of execution start.
         public static void main(String[] args) throws IOException
                   //SnmpUtils obj = new SnmpUtils("XX.XX.XX.XX", "public", 1, 1500);
                for(int i = 0; i < 10; i++)
                  MySNMP obj = new MySNMP("MY_IP","public",1,1000);
                   String arrGet = obj.snmpGet(".1.3.6.1.2.1.1.1.0");
                   System.out.println("\nGET RESPONSE");
                   System.out.println(arrGet);
                   String arrGetNext = obj.snmpGetNext(".1.3.6.1.2.1.1.1.0");
                   System.out.println("\nGETNEXT RESPONSE");
                   System.out.println(arrGetNext);
                   String[] arr = { ".1.3.6.1.2.1.2.2.1.1.", ".1.3.6.1.2.1.2.2.1.5" };
                   String arrGetTable = obj.snmpGetTable(arr);
                   System.out.println("\nGETTABLE RESPONSE");
                   System.out.println(arrGetTable);
          *  Parameterized constructor
         public MySNMP(String IP, String commString, int version, long timeout)
              // Create an instance of the Snmp class, CommunityTarget class
              try
                   snmp = new Snmp(new DefaultUdpTransportMapping());
              catch (IOException e)
                   e.printStackTrace();
              target = new CommunityTarget();
              Address targetAddress = GenericAddress.parse("udp:" + IP + "/161");
              // Set the address of the target device; This is a mandatory value to be passed by the calling script
              target.setAddress(targetAddress);
               *  Set the version of the target device;
               *  In cases where the version provided is not 1,2 or 3, the default value set is 1 
              if (version == 1)
                   target.setVersion(SnmpConstants.version1);
              else if (version == 2)
                   target.setVersion(SnmpConstants.version2c);
              else if (version == 3)
                   target.setVersion(SnmpConstants.version3);
              // Set the timeout of the target device
              target.setTimeout(timeout);
               *  Set the community string of the target device;
               *  In cases where the community string provided is not null, the default value is set as "public" 
              if (commString == null)
                   target.setCommunity(new OctetString("public"));
              else
                   target.setCommunity(new OctetString(commString));          
          *  SNMP get/getNext operation logic
         public void get(String oid, int pduType) 
              // Create a PDU with the OID and type
              requestPDU = new PDU();
              requestPDU.add(new VariableBinding(new OID(oid)));
              requestPDU.setType(pduType);
              ResponseEvent response = null;
              try
                   // Invoke the listen() method on the Snmp object
                   snmp.listen();
                   // Send the PDU constructed, to the target
                   response = snmp.send(requestPDU, target);
              catch (IOException e)
                   e.printStackTrace();
              // Retrieve the response details and put into an array called "responseArray"
              PDU responsePdu = response.getResponse();
              if(responsePdu.getErrorStatus() == 0)
                   responseString = responsePdu.toString();
              else
                   System.out.println("ERROR");
              if (!(response.getResponse() == null))
                   //Extract the response
          *  SNMP GET method API
         public String snmpGet(String oid)
              get(oid, PDU.GET);
              return(responseString);          
          *  SNMP GETNEXT method API
         public String snmpGetNext(String oid) throws IOException
              get(oid, PDU.GETNEXT);
              return(responseString);     
          *  SNMP getTable operation
         public String snmpGetTable(String[] oid)
              // Invoke the listen() method on the Snmp object
              try
                   snmp.listen();
              catch (IOException e)
                   e.printStackTrace();
              // Create a TableUtils
              TableUtils utils = new TableUtils(snmp, new DefaultPDUFactory());
              // Set the lower/upper bounds for the table operation
              OID lowerIndex = null;
              OID upperIndex = null;
              // Create an array of the OID's that need to be checked
              OID[] arr = new OID[oid.length];
              for (int i=0; i<oid.length; i++)
                   arr[i] = new OID(oid);
              // Transfer output to a data structure
              List list = utils.getTable(target, arr, lowerIndex, upperIndex);
              // Dump the response into an array called "responseArray"
              return responseString;

  • [32282.000367] firefox:2114 freeing invalid memtype c02f2000-c0302000 I get this from system log using latest version of Firefox: What kind of problem is this?

    I get this from system log using latest version of Firefox:
    [32282.000367] firefox:2114 freeing invalid memtype c02f2000-c0302000
    What kind of problem is this?
    Anyway Firefox seem to be working correct. I would like to be sure that it'snt a security problem.

    Thanks a lot for your swift response. And sorry if it was a bit too hectic to go through my detailed query (which I did because it was misunderstood when I asked previously). As I've mentioned above, I was informed that updating to 5.0.1 would '''require''' me to '''delete''' the current version and then install the new one. And doing so will involve losing all my bookmarks. I guess I should have been more specific and detailed there. By losing, I didn't mean losing them forever. I'm aware that they're secured in some place and deleting and installing the software doesn't harm its existence. What I meant that if I install the new version, I'd have to delete the old one. And after installing the new version, I'd have to transfer them (bookmarks) back from wherever they are. Get it? When it updated from 3.6.9 to 3.6.13, and from 3.6.13 to 3.6.18, I didn't need to follow that process. They were already present on their own.
    BTW, I'm having no problems with 3.6.18 but after learning about the existence of version 5.0.1, I'm a bit too eager to lay my hands over it.
    Thanks for your help; hope this wasn't extremely long.

  • Logging using Log4J

    Hi,
    I want to use Log4J to write to the sap log using a Log4J appender. I followed the tutorial from https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/36085e78-0801-0010-678d-8b4e89ddff3c
    but i doesnt work for me. When i check the ear which is deployed to the server, i cant find my log4j.properties file anywhere...i guess that is the problem. I put it in the src folder...i thought it was the correct place, but it doesnt show up in the ear...can anyone help me out?
    Much thanks,
    Hugo Hendriks

    Please don't crosspost. It cuts down on the effectiveness of responses, leads to people wasting their time answering what others have already answered, makes for difficult discussion, and is generally just annoying and bad form.

  • Acquire, analyze and data log using statemachine technique

    I am learning state machine technique to develop code for data acquisitoin and logging. I think I have written the correct code for this purpose but I couldn't get the following done:
    All warning values(>0) should be displayed on 1d array on front panel. The code is writing only the first value.
    All values should be logged using write to spreadsheet pallete and be written on excel sheet. Code is only writing first value.
    I wonder what's the mistake. The code I've created is attached, I'd appreciate if anyone correct the code and post in reply.
    Many thanks in advance for help
    Cheers
    Solved!
    Go to Solution.
    Attachments:
    full project with acquire,analyse and logging states.vi ‏94 KB

    Hi kwaris,
    "what's the mistake": Well, you use a lot of unneccessary conversions. Really a lot of...
    Why do you convert a scalar to dynamic, then convert to array, then index an element of the array? Why do you convert to dynamic when all you needis a simple "build array" node?
    Ok, I included a shift register to store your array. It's only a simple "how to", but not the best solution for all cases. But it should give you a hint...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    full project with acquire,analyse and logging states.vi ‏12 KB

  • Basic MIB and SNMP understanding using JMX

    Hello
    i am trying to get my head around SNMP using JMX, but i am finding it dificult to know where to start.
    ideally i would love to find some basic code and go through it, so that i can understand it.
    i would love to find some code which just "Gets" one parameter from a mib stored on a seperate PC and displays it on another PC.
    I have looked at advent - to complex for what i want.
    Any help or suggestions - or possibly Code!! would be appreciated.
    Thanks
    Norman

    There is an example code included in the upcoming book "JMX: Managing J2EE with Java Management Extensions" that shows how to retrieve a simple attribute value from an JMX SNMP Adaptor using the Sun JDMK and AdventNet SNMP toolkits. It's a brief introduction to SNMP integration but should get you started.
    http://www.amazon.com/exec/obidos/ASIN/0672322889/104-6670791-7933546
    Unfortunately you still have to wait a week or two to get it.
    Basically the examples show how you can generate the required MBeans from an SNMP MIB definition (in Sun's JDMK this is a tool called MibGen), then register the SNMP Adaptor to the MBean server and associate and register the MBeans that were generated from the MIB to the adaptor. You can then use an SNMP client to connect to the adaptor and manipulate the MBeans through SNMP.
    Hope this is of some help.
    -- Juha

  • Unable to Generate Logs using Log4j

    Hi All,
    I have a task where i have configure weblogic to generate the logs using log4j instead of the default jdk,
    I changed the logging level implementation in admin server from jdk to log4j
    Then i created a log4j.xml and placed it in the root folder of the domain.
    But the adminserver.log file still shows the logs from default jdk the log4j changes tht i did had no effect on the logs.
    Kindly Help
    Thanks
    Mukul

    Hi ,
    I dont have any log4j.properties defined . Should i define a custom log4j.properties.
    This is how my log4j.xml is :
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration>
    <appender name="FILE" class="org.apache.log4j.FileAppender">
    <param name="File" value="myApp.log"/>
    <param name="Append" value="true"/>
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ISO8601} %t %-5p %c{2} - %m%n"/>
    </layout>
    </appender>
    <logger name="org.apache">
    <level value="WARN"/>
    </logger>
    <logger name="org.springframework">
    <level value="WARN"/>
    </logger>
    <root>
    <level value="DEBUG"/>
    <appender-ref ref="FILE"/>
    </root>
    </log4j:configuration>
    But this is generating a custom log4j log file but we want the weblogic generated adminserver.log to be generated using the log4j instead of jdk

  • Reading SNMP packet using PL/SQL and XML

    Hi,
    Is it possible to read the content of a SNMP packet using MIB file converted into XML. I know it's possible to develop a java program which can collect SNMP packets from the network and inserts them into Oracle. The problem after that is how to read the content using MIB library file. It's possible to convert the MIB file into XML file but the problem is to create s PL/SQL block which can read the XML file and based on the content to translate the information from the SNMP packet. Is it possible?
    regards
    Edited by: user10484841 on Sep 24, 2010 3:15 AM

    Thank you for the reply!
    I have converted oracle MIB into xml using prtg's import tool. As far as I see prtg also uses xml as you can see below.
    So how I can translate string for example 1.3.6.1.2.1.39.1.1.1.1.1111111111 using xml and pl/sql?
    Can you give me direction where to start?
    <?xml version="1.0" encoding="ISO8859-1" ?>
    <oidlist>
    <system>
    <version>
    1
    </version>
    </system>
    <list>
    <entry>
    <name>
    RDBMS-MIB|rdbms db: #[1.3.6.1.2.1.39.1.1.1.1]|rdbms db index
    </name>
    <oid>
    1.3.6.1.2.1.39.1.1.1.1
    </oid>
    <type>
    vmAbsolute
    </type>
    <kind>
    mkTable
    </kind>
    <unittype>
    sutCustom
    </unittype>
    <units>
    </units>
    <indicator>
    rdbms db index
    </indicator>
    <scale>
    1
    </scale>
    <multiply>
    no
    </multiply>
    <max>
    0
    </max>
    <usegetnext>
    no
    </usegetnext>
    <is64bit>
    no
    </is64bit>
    <isunsigned>
    no
    </isunsigned>
    <isfloat>
    no
    </isfloat>
    <description>
    A numeric index, unique among all the databases from all products on this host. This value is a surrogate for the conceptually unique key, which is {PrivateMibOID, databasename}
    </description>
    </entry>
    <entry>
    <name>
    RDBMS-MIB|rdbms db info: #[1.3.6.1.2.1.39.1.1.1.3]|rdbms db info size units
    </name>
    <oid>
    1.3.6.1.2.1.39.1.2.1.3
    </oid>
    <type>
    vmAbsolute
    </type>
    <kind>
    mkTable
    </kind>
    <unittype>
    sutCustom
    </unittype>
    <units>
    </units>
    <indicator>
    rdbms db info size units
    </indicator>
    <scale>
    1
    </scale>
    <multiply>
    no
    </multiply>
    <max>
    0
    </max>
    <usegetnext>
    no
    </usegetnext>
    <is64bit>
    no
    </is64bit>
    <isunsigned>
    no
    </isunsigned>
    <isfloat>
    no
    </isfloat>
    <description>
    Identification of the units used to measure the size of this database in rdbmsDbInfoSizeAllocated and rdbmsDbInfoSizeUsed. bytes(1) indicates ndividual bytes, kbytes(2) indicates units of kilobytes, mbytes(3) indicates units of megabytes, gbytes(4) indicates units of gigabytes, and tbytes(5) indicates units of terabytes. All are binary multiples -- 1K = 1024. If writable, changes here are reflected in the get values of the associated objects.
    </description>
    </entry>
    <entry>
    <name>
    RDBMS-MIB|rdbms db info: #[1.3.6.1.2.1.39.1.1.1.3]| rdbms db info size allocated
    </name>
    <oid>
    1.3.6.1.2.1.39.1.2.1.4
    </oid>
    <type>
    vmAbsolute
    </type>
    <kind>
    mkTable
    </kind>
    <unittype>
    sutCustom
    </unittype>
    <units>
    </units>
    <indicator>
    rdbms db info size allocated
    </indicator>
    <scale>
    1
    </scale>
    <multiply>
    no
    </multiply>
    <max>
    0
    </max>
    <usegetnext>
    no
    </usegetnext>
    <is64bit>
    no
    </is64bit>
    <isunsigned>
    no
    </isunsigned>
    <isfloat>
    no
    </isfloat>
    <description>
    The estimated size of this database (in rdbmsDbInfoSizeUnits), which is the disk space that has been allocated to it and is no longer available to sers on this host. rdbmsDbInfoSize does not necessarily indicate the amount of space actually in use for database data. Some databases may support extending allocated size, and others may not. Note that a compliant agent does not need to allow write access to this object.
    </description>
    </entry>
    </list>
    </oidlist>
    *Note that the xml file is not full die to 30000 character restriction of oracle's forum
    regards
    Edited by: user10484841 on Oct 19, 2010 6:07 PM
    Edited by: user10484841 on Oct 19, 2010 6:07 PM

  • How to access sharepoint logs using Java?

    Is there a way to access Sharepoint logs using Java from a remote machine? 
    Any help / pointers would be appreciated. Thanks.

    Hello,
    I am not aware about any client modal class for log but if you create your own service and host in SP server then you can call this web service in JAVA. (i am not sure whether JAVA supports .NET web service or not).
    You can refer this for web service:
    http://www.arboundy.com/2010/12/centalised-view-of-sharepoint-uls-log-files/
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Getting Error while decrypt a file using Blowfish algorithm

    I am using blowfish algorithm for encrypt and decrypt my file. this is my code for encrypting decrypting .
    while i am running program i am getting an Exception
    Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded
    at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
    at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
    at com.sun.crypto.provider.BlowfishCipher.engineDoFinal(DashoA6275)
    at javax.crypto.Cipher.doFinal(DashoA12275)
    at Blowfishexe.main(Blowfishexe.java:65)
    import java.security.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.io.*;
    import org.bouncycastle.crypto.CryptoException;
    import org.bouncycastle.crypto.KeyGenerationParameters;
    import org.bouncycastle.crypto.engines.DESedeEngine;
    import org.bouncycastle.crypto.generators.DESedeKeyGenerator;
    import org.bouncycastle.crypto.modes.CBCBlockCipher;
    import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
    import org.bouncycastle.crypto.params.DESedeParameters;
    import org.bouncycastle.crypto.params.KeyParameter;
    import org.bouncycastle.util.encoders.Hex;
    public class Blowfishexe {
    public static void main(String[] args) throws Exception {
    KeyGenerator kgen = KeyGenerator.getInstance("Blowfish");
              kgen.init(128);
              String keyfile="C:\\Encryption\\BlowfishKey.dat";
    SecretKey skey = kgen.generateKey();
    byte[] raw = skey.getEncoded();
    SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");
              System.out.println("key"+raw);
                   byte[] keyBytes = skey.getEncoded();
                   byte[] keyhex = Hex.encode(keyBytes);
                   BufferedOutputStream keystream =
    new BufferedOutputStream(new FileOutputStream(keyfile));
                        keystream.write(keyhex, 0, keyhex.length);
    keystream.flush();
    keystream.close();
    Cipher cipher = Cipher.getInstance("Blowfish");
    cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
              System.out.println("secretKey"+skeySpec);
    FileOutputStream fos=new FileOutputStream("C:\\Encryption\\credit11.txt");
              BufferedReader br=new BufferedReader(new FileReader("C:\\Encryption\\credit.txt"));
              String text=null;
              byte[] plainText=null;
              byte[] cipherText=null;
              while((text=br.readLine())!=null)
              System.out.println(text);
              plainText = text.getBytes();
              cipherText = cipher.doFinal(plainText);
              fos.write(cipherText);
              br.close();
              fos.close();
              cipher.init(Cipher.DECRYPT_MODE, skeySpec);
              FileOutputStream fos1=new FileOutputStream("C:\\Encryption\\BlowfishOutput.txt");
              BufferedReader br1=new BufferedReader(new FileReader("C:\\Encryption\\credit11.txt"));
              String text1=null;
              /*while((text1=br1.readLine())!=null)
                   System.out.println("text is"+text1);
                   plainText=text1.getBytes("UTF8");
                   cipherText=cipher.doFinal(plainText);
                   fos1.write(cipherText);
              br1.close();
              fos1.close();
    //byte[] encrypted = cipher.doFinal("This is just an example".getBytes());
              //System.out.println("encrypted value"+encrypted);*/
    Any one pls tell me how to slove my problem
    thanks in advance

    hi
    i got the solution. its working now
    but blowfish key ranges from 56 to448
    while i am writing the code as
    KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
    keyGenerator.init(448);
    this code is generating the key upto 448 bits
    but coming to encoding or decode section key length is not accepting
    cipher.init(Cipher.ENCRYPT_MODE, key);
    Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.a(DashoA12275)
    at javax.crypto.Cipher.init(DashoA12275)
    at javax.crypto.Cipher.init(DashoA12275)
    at Blowfish1.main(Blowfish1.java:46)
    i am getting this error
    what is the solution for this type of exception.
    thank you

  • Concurrent HOST program calling a proc to log using fnd_file.put_line

    Hello all,
    I have a concurrent HOST program that does 3 main things
    1. Calls a sqlplus program to do some initializing. This program is a proc in a package.
    2. Runs sqlldr to load data to custom tables.
    3. Calls a sqlplus program to do manipulate the data. This program is a proc in a package.
    In step 3 of above, the package procedue does a "submit_request" to call the "Supplier Open Interface Import". This
    request actually fires. However my problem is the subsequent call to fnd_file.put_line(fnd_file.log, 'Test message'), does not get logged
    to the log file of the HOST program, nor to the log file of the "Supplier Open Interfface Import" log file. A check
    of $APPLPTMP (or /usr/tmp) shows that a file of say " l0023761.tmp" contains my 'Test message' text.
    I believe the problem is that the put_line() call has no association with the HOST or the "Supplier Open Interface Import. How
    do I associate the logging to either program? Is it even possible? I want the logging, so as to see the progress
    of the HOST program.
    The sniippet of proc code is:
    PROCEDURE abc() IS
    BEGIN
    request_id:= FND_REQUEST.SUBMIT_REQUEST
    (Application => 'SQLAP'
    ,Program => 'APXSUIMP'
    ,Description => NULL
    ,Start_time => SYSDATE
    ,Sub_Request => FALSE
    ,Argument1 => 'ALL'
    ,Argument2 => 1000
    ,Argument3 => 'N'
    ,Argument4 => 'N'
    ,Argument5 => 'N'
    fnd_file.put_line (fnd_file.log,'Test message');
    COMMIT;
    END abc;
    Alex.

    Shell scripts are very hard to develop and maintain. Many things that developers previously had to do in shell scripts, developers can now do in PL/SQL. Hence, I recommend that you avoid shell scripts as much as possible.
    As well, SQL*Loader is an old, inflexible tool. Instead, define your OS file as an external table, and then extract from the external table using a normal select statement. http://www.orafaq.com/node/848 I recommend that you avoid SQL*Loader and use external tables instead.
    Using PL/SQL and external tables - and avoiding the shell script and SQL*Loader - a much better way to accomplish the same thing all inside one packaged procedure that is registered as a concurrent program:
    - initialize
    - select from the external table
    - manipulate the data

  • How do I log use two apple ID's on the same I mac with two user accounts

    I cant seem to find a thread to answer this question.
    I have have one I mac, both my wife and I have a user account each, we both have our own apple ID's is there away they can be used at the same time?
    As so far I can't find a way of doing this. It seems one user account can only use its apple ID for a period of 90days, If I need to use the other apple ID I have to wait.. as I get this messsage
    "You can download past purchases on this computer with just one Apple ID every 90 days. You cannot associate this computer with a different Apple ID for 61 days. "
    Is there a way around this?

    Oh...How about one APPLE account, but two different users on the computer- one being administrator, and allow admin privileges if you want, or one be admin, the other a user.
    Or- what you can do, is have the second apple account, but only log in to it without involving the computer.
    Or break down and get a second computer. On hers, you be guest user and on yours she be guest- then if one breaks, you can still each use in turn.
    Or alternately, go to applestore or contact apple to ask...

  • Decryption of image using AES in windows 8.1

     Hi ,
        I am developing an app in windows 8.1, in which I got image in decryption format ,
    it was encrypted using AES and I know the key
    I tried in oneway but i am getting an error "The supplied user buffer is not valid for the requested operation"
    please help how to decrypt the image and bind it to ui
    Thanks
    Sarvesh
    sarvesh

    Hi Sarvesh,
    I've replied you in another thread, please feel free to check it :)
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • [MFC] Error Importing logs using SCP - "Error while downloading file. The remote host has terminated the connection"

    Background: 
    In order to transfer logs to MFC, we had to use an intermediate logging server in our OOB network.  When this logging server crashed we had to rebuild the server with new hardware and SCP no longer worked.
    Issue: 
    The host key changed on the new server and had to be manually updated.  We suspected it was related to the hosts key but had difficulty finding where the known hosts info was stored.
    Solution: 
    Go to your install location of MFC and remove the known_hosts file.  In our case the file was located at:  "D:\Program Files\IronPort Systems\Mail Flow Central\mailFC\tmp\known_hosts".  Instead of removing the file, we renamed it to known_hosts.old and restarted the MFC service.  Afterwards we could see all the old logs importing.
    The issue itself was not difficult to resolve, it just took more time than expected for something that would seem straightforward.  To complicate things, we even raised a query to customercare who came back saying that they do not support the server on which MFC is running.  But clearly the source of the issue was related to the application rather than the server itself.

    Thanks for your comment qetzacoatl, however I don't this this will work for me, I am on a team, and we need to be able to check-in/out files and make sure we don't override eachothers work. I also don't want to have to use 2 programs to accomplish the task one should be able to do. Its now 3 weeks going and I can't get any work done, it seems like its getting worse. Nobody from Adobe seems to want to comment on my thread at all....So maybe I should just find a completely new solution and get rid of DW all together, Aptana is looking VERY nice right about now.

Maybe you are looking for

  • How can I install beacons in a place?

    Hi, is there an "easy way" to install beacons in a place and set them without using third-party services like these ones: http://www.fosbury.co/beacon-comparison Thank you for your info Eric

  • IPod touch and Aperture 3.1 syncing issues

    I can't sync photos from Aperture 3.1 with iPod touch and iPad iOS 4.2.1. The strange think is that only the first picture of the event is synced but not the rest. Another strange think is that the most recent event syncs fine and it consists of seve

  • Copy contacts from iPhone to Address Book in Outlook

    Hi there, I'm asking to see whether it's possible to copy contacts from an iPhone to the Address Book in Outlook, reason why I ask is that I am trying to help my Managing Director with his wife's Outlook issue as described in the following link http:

  • HT2736 I need to send more than $100 worth of e-gift certificates this month. Can I get my limit raised?

    Hi, I am trying to send gift certificates to some contest winners. Seems that the limit is $100 and I need to send a total of $220 on top of the $90 I've already sent. Can I get my limit raised? This is a one time happening. Thanks!

  • TreeSet with Objects

    Hello, I am doing something silly, and I can't figure it out. I want to use TreeSet with Objects, not strings, the code below throws a class cast exception: Exception in thread "main" java.lang.ClassCastException: com.generatescape.newtreemodel.Canal