...
JMX technology enables Java applications to be managed without heavy investment: A JMX technology agent can run on most Java technology-enabled devices, thus Java applications can become manageable with little impact on their design. A Java application simply needs to embed a managed object server and make some of its functionality available as one or several managed beans (MBeans) registered in the object server; that is all it takes to benefit from the management infrastructure.
The architecture of JMX is shown below :https://195.227.0.189/NovaSpy/attachment/wiki/NovaSpy/Conceptual/OSSensor/AbstractApproaches/jmx_architecture.jpg *
At the instrumentation level components called MBeans provide the application-specific management information. The MBeans provide the essential visibility and control for managing applications.
- The Agent level (MBean server) interfaces to the MBean components and provides a management interface to these components. The MBean Server is the key component in this layer, and provides a set of management functions useful to managing MBeans.
- The Connector Level consists of one or more connector (or protocol adaptor) components that provide access to remote management systems. Depending on the protocols supported by the JMX implementation, remote managers supporting SNMP, HTTP, or other management protocols can access the management information and control exposed by the MBeans for each application. Multiple management systems using different protocols can now simultaneously access the application management capability.
- With the management console (JConsole) it's possible to inspect and interact with MBeans as well as set any properties and invoke operations. JMX does not have a graphical user interface, but the informations we're getting out of the JMX Agent can also be used by other clients such as NovaSpy.inspectIT
- Advantages of JMX
- fully integrated since J2SE 5.0
- can be used for out-of-the-box management of the Java VM
...
The Java Native Interface is needed for getting informations like the cpu usage of der underlying OS. It's impossible querying for cpu usage with pure Java so we need to go through the JNI to call native methods. Getting the informations out of Windows it's needed to compile the DLLs with a C-Compiler and under Linux it's needed to compile the .so (shared objects) files.
The architecture of JNI is shown below: https://195.227.0.189/NovaSpy/attachment/wiki/NovaSpy/Conceptual/OSSensor/AbstractApproaches/jni_architecture.png
- Advantages of JNI
- direct access to OS resources
- native code is faster than Java code
- Disadvantages of JNI
- subtle errors in the use of JNI can destabilize the entire JVM in ways that are very difficult to reproduce and debug
- no garbage collection for the JNI side
- portability