English 中文(简体)
Trying to understand what snmp4jAgentJMX does and if it suits what I need
原标题:
  • 时间:2009-11-30 12:09:02
  •  标签:
  • java
  • jmx
  • snmp

I been trying to write an snmp wrapper agent for my JMX Enabled application which will translate all the information that is layd out in JMX MBeans into SNMP attributes.

I m a bit at loss in trying to understand where to start and what to use. From what I ve read, snmp4j is probably the go to snmp library for Java but I couldn t manage to understand the code examples that are in the Snmp4jAgent.

Also, from reading the description for SNMP4JAgentJMX in the authors web site I think Snmp4jAgentJMX could help me write this agent but I could not understand how to use it. Actually, looking at the example code (org.snmp4j.agent.mo.jmx.example.JMXTestAgent) I could not find the part where the code registers with any MBean or JMX Factory, which led me to assume that what I did not understand correctly what this code does.

I would very much appreciate code examples and/or some tutorials or documentation for someone who has not had experience with SNMP.

Thank you!!

最佳回答

The SNMP agent provided by jmx2snmp is incomplete and has errors. There is little more to do to write a SNMP agent. For example SNMPv1 is not correctly supported (error status). GETBULK is not supported (mandatory for SNMPv2). GETNEXT called on a non-existing OID in the agent, does not return the next OID but noSuchObject instead (which must never be returned on a GETNEXT), SET is not supported at all, and most likely many other issues.

Therefore I recommend using SNMP4J-AgentJMX in conjunction with SNMP4J-Agent and SNMP4J (as an author of those). The exmple agent does the mapping between JMX and SNMP during initialization in the MIB instrumentation class JvmManagementMibInst in the method addJvmManagementMibInstrumentaton.

Here you will find plenty of examples how the descriptive mapping can be done. If you have already a MIB specification, then you can use AgenPro to generate the Mib stub class and you will have to do basically only the mapping as shown in the sample JvmManagementMibInst.java class.

If you do not have a MIB yet, then I would also recommend to use a MIB designer tool (like MIB Designer) to create the MIB because this is most likely an interative process and you will have to restructure the MIB when you discover easier ways to map to JMX.

问题回答

After much research it I found this package that uses snmp4j agent to wrap JMX and give out SNMP services.

With this package, all you have to do is register with the MBean and change the JMX-SNMP mapping.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签