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

2442 questions
45
votes
5 answers

How to connect to a java program on localhost jvm using JMX?

I should connect to a java program on localhost jvm using JMX. In other words I want to develop a JMX client to config a java program on localhost. Don't recommend using JConsole! JConsole is not suitable because it is general JMX client and have…
mjafari
  • 694
  • 2
  • 12
  • 22
44
votes
4 answers

jmeter pass command line variables into a jmx

I'm trying to automate some perf testing. I'd to pass server locations into a generic jmx from a Jenkins job. I'd like to be able to do something like: jmeter -n -t foo.jmx -JtestingIP=IP and have foo.jmx pick up testingIP. What is the proper…
GeorgeFabian
  • 461
  • 1
  • 4
  • 3
41
votes
2 answers

JMX password read access issue

When I try to use JMX to monitor an application like this: java -Dcom.sun.management.jmxremote.port=9999 \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ JMX_tester it tells me: Error:…
Black Magic
  • 2,706
  • 5
  • 35
  • 58
39
votes
4 answers

How to access Spring-boot JMX remotely

I know that spring automatically expose JMX beans. I was able to access it locally using VisualVM. However on prod how I can connect to remotely to the app using it's JMX beans? Is there a default port or should I define anything in…
rayman
  • 20,786
  • 45
  • 148
  • 246
39
votes
3 answers

other open source alternatives to codahale's "metrics"?

I came across the metrics project from codahale, and I believe that it is used at Yammer. I like this solution, but want to know if there are other open source alternatives with similar capabilities.
user2145809
  • 571
  • 2
  • 6
  • 8
34
votes
1 answer

MBean persistence

I have a problem with persistence of my config MBean. My configuration:
Jakub C
  • 595
  • 1
  • 5
  • 14
33
votes
5 answers

How to connect to Java instances running on EC2 using JMX

We are having problem connecting to our Java applications running in Amazon's EC2 cluster. We definitely have allowed both the "JMX port" (which is usually the RMI registry port) and the server port (which does most of the work) to the…
Gray
  • 115,027
  • 24
  • 293
  • 354
32
votes
10 answers

How to enable remote JMX on Kafka brokers (for JmxTool)?

I enabled JMX on Kafka brokers by adding KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false …
sui
  • 353
  • 1
  • 3
  • 7
32
votes
5 answers

What do you monitor with JMX in your production Java application?

This question is not about how JMX works or what JMX does. This question is about applications of JMX in a standard application server environment in production. It is not for specific server either. What do you monitor with JMX in production…
topchef
  • 19,091
  • 9
  • 63
  • 102
31
votes
6 answers

JMX Defined

I am looking for: What JMX is. Where I can find some good JMX Tutorials. What JMX can provide to me as a Java EE programmer. Anything else I should be aware of.
mainstringargs
  • 13,563
  • 35
  • 109
  • 174
30
votes
12 answers

How do you enable JMX in Websphere?

I would like to use JConsole to monitor my Websphere application, but I am not sure how to enable JMX.
None
29
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
  • 3,202
  • 6
  • 27
  • 57
28
votes
7 answers

Does Java 6 open a default port for JMX remote connections?

My specific question has to do with JMX as used in JDK 1.6: if I am running a Java process using JRE 1.6 with com.sun.management.jmxremote in the command line, does Java pick a default port for remote JMX connections? Backstory: I am currently…
Bob Cross
  • 22,116
  • 12
  • 58
  • 95
28
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,262
  • 3
  • 16
  • 23
28
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
  • 10,413
  • 7
  • 36
  • 52