Questions tagged [jmx]

Java Management eXtensions is a standard Java API that enables the instrumentation and monitoring of a running Java program.

JMX

Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (e. g. printers) and service oriented networks. Those resources are represented by objects called MBeans (for Managed Bean). In the API, classes can be dynamically loaded and instantiated. Managing and monitoring applications can be designed and developed using the Java Dynamic Management Kit (JDMK) which is also available and more commonly implemented using the open sourced version OpenDMK.

JMX classes live in the javax.management packages.

JMX is a part of the Java platform since Java SE 5 (though some components are optional and not bundled with the JRE).

References


Glossary

  • MBean: A logical unit, or service, most easily visualized as a Java Bean, that provides a defined service exposed through the JMX protocol. One instance of an MBean typically is identified by an ObjectName (see below). These services commonly include, but are not limited to:
    1. Getters and Setters that allow the reading and writing of the MBean's Attributes. For example, an MBean might represent a thread pool and an attribute named MaxPoolSize could be read to determine what the maximum allowable size of the pool is, while writing the attribute would modify the maximum allowable size of the pool that the MBean is managing.
    2. Operations that execute a specific piece of functionality in an MBean. Operations can be thought of as bean methods that do not fit the attribute (or Java Bean property) model. They may have no return value and have zero, one or more parameters. For example, an operation called stop might stop the thread pool that is managed by an MBean.
    3. MBeans may emit Notifications when a specific condition is met, or the MBean detects a specific event. Notifications can be subscribed to by NotificationListeners that have registered to be notified of these events. For example, an MBean might send notifications when the thread pool it manages is started, and then again when it is stopped.
  • MBeanServer: The MBeanServer plays multiple roles in a JMX environment:
    • It is the central registry for MBeans within a given JMX domain. As the registry, the MBeanServer provides functionality to register, unregister, enumerate and search for MBeans.
    • The MBeanServer provides the invocation interface for accessing registered MBeans. When a thread wants to read or write attributes, execute an operation or [un]register a notification listener in an MBean instance, it does so through the MBeanServer by providing the ObjectName of the target MBean and the parameters of the invocation.
  • ObjectName: This is a composite key that serves to both define the unique identity of one MBean, and as pattern that describes a group of MBeans that have matching sub-keys of their ObjectNames in common. There are 2 parts to an ObjectName:
    1. The Domain Name:
    2. The Key Properties:

A visual of the structure of an ObjectName

2321 questions
25
votes
5 answers

Is a good idea to enable jmx (lambda probe) on a production server?

We are experiencing some slowdowns on our web-app deployed on a Tomcat 5.5.17 running on a Sun VM 1.5.0_06-b05 and our hosting company doesn't gives enough data to find the problem. We are considering installing lambda probe on the production server…
Serxipc
  • 6,371
  • 9
  • 38
  • 50
25
votes
2 answers

How to get percentage of CPU usage of OS from java

I want to calculate percentage of CPU usage of OS from java code. There are several ways to find it by unix command [e.g. using mpstat, /proc/stat etc...] and use it from Runtime.getRuntime().exec But I don't want to use the system calls. I tried…
G.S
  • 9,039
  • 7
  • 29
  • 44
23
votes
2 answers

Does enabling JMX agent have a performance overhead?

I would like to have a possibility to use jconsole in production, but am a bit concerned about performance. Is it ok to leave JMX agent running (via -Dcom.sun.management.jmxremote) or will it have a noticeable performance footprint?
azerole
  • 1,212
  • 3
  • 15
  • 23
23
votes
3 answers

Bypassing JConsole requirement for username/password - when using a Jaas custom login module with JMX to handle authorization and authentication

I'm using JConsole to access an MBean that is running. The MBean uses a custom Jaas login module and is run with the following command: java -classpath UserLGUGroupHandlingApplication.jar;MBeanSecure.jar…
Loco234
  • 511
  • 4
  • 19
23
votes
3 answers

Remote monitoring with visualvm and JMX

I would like to monitor a remotely running java (spring boot) application with jvisualvm (or jconsole). When running locally, I can see the managed beans in both jvisualvm and jconsole. When running remotely I cannot connect. I tried it with…
user152468
  • 2,784
  • 5
  • 20
  • 49
22
votes
5 answers

Not able to Connect a Remote Host to the VisualVM

I am new to Java and I'm facing a problem in connecting a Remote Host to the JVisualVM. I've searched the Internet and followed all the steps mentioned there but still am not able to resolve the issue. The steps I followed are: I started the jstatd…
rushi
  • 495
  • 3
  • 7
  • 16
22
votes
5 answers

How to have JMX bind to a specific interface?

I am currently starting my Java VM with the com.sun.management.jmxremote.* properties so that I can connect to it via JConsole for management and monitoring. Unfortunately, it listens on all interfaces (IP addresses) on the machine. In our…
Marc Novakowski
  • 42,180
  • 11
  • 55
  • 62
22
votes
3 answers

Have you used Perf4J to collect and analyze performance metrics in Java app?

Did you use Perf4J in your Java application to collect and analyze performance stats? What was the typical pattern (using log files, utilities, UI, JMX, etc.)? Did you use annotations and AOP-based features? Did you use any JMX integration? How…
topchef
  • 17,019
  • 8
  • 58
  • 98
22
votes
2 answers

Meaning of Spring @ManagerResource: persistPolicy, persistPeriod, persistLocation and currencyTimeLimit

What does the following fields mean in Spring @ManagedResource used for JMX? There is no Javadoc or related description in Spring documentation. 1. String persistPolicy() default ""; 2. int persistPeriod() default -1; 3. String…
Mohsen
  • 3,412
  • 3
  • 31
  • 58
21
votes
4 answers

JBoss AS 7 JMX Console

I spent some time checking out JBoss AS7 today. I am impressed with what I have seen so far but I noticed that good ol' JMX-Console no longer exist. Does anyone know why it was left out? I understand that I can connect through JConsole, MC4J etc.…
helios
  • 2,193
  • 4
  • 18
  • 26
21
votes
6 answers

Unable to use JConsole with Tomcat running as windows service

I am running tomcat 6.0.18 as a windows service. In the service applet the jvm is configured default, i.e. it is using jvm.dll of the JRE. I am trying to monitor this application with JConsole but cannot connect to it locally. I added the parameter…
Kees de Kooter
  • 6,451
  • 5
  • 37
  • 42
21
votes
1 answer

How do I give a name to a VisualVM ""?

JDK 1.6 comes bundled with a handy tool called VisualVM that lets you inspect and interact with running Java processes. One feature is that it auto-detects running JVMs on the local machine. Most are listed as " (pid xxxx)" but some have a name…
Chris Dolan
  • 8,557
  • 2
  • 29
  • 71
20
votes
5 answers

Is there any JMX - REST bridge available?

Hi I would like to monitor a Java application using the browser but at the same time utilising the existing JMX infrastructure. I know that JMX provides a HTTP interface but I think it provides a standard web gui and its not possible to mashup its…
Kostas
  • 672
  • 3
  • 8
  • 17
19
votes
4 answers

Failed to Unregister DataSource JMX MBean While Shutting Down a Spring Boot Application

I have a simple Spring Boot application using org.apache.commons.dbcp2.BasicDataSource as dataSource bean. The data source is exposed as MBean automatically by Spring boot. The bean declaration: @Bean public DataSource dataSource() { …
jlai
  • 659
  • 1
  • 7
  • 15
18
votes
5 answers

List of JMX objects and attributes?

I am trying to implement a nagios plugin, and doing so requires that I know specifically what object and attribute I want to monitor. The thing is, I haven't been able to find a listing anywhere of the standard system jmx objects and attributes. Can…
Matthew
  • 462
  • 1
  • 5
  • 16