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
43
votes
5 answers

How to access JMX interface in docker from outside?

I am trying to remotely monitor a JVM running in docker. The configuration looks like this: machine 1: runs a JVM (in my case, running kafka) in docker on an ubuntu machine; the IP of this machine is 10.0.1.201; the application running in docker…
Eric Broda
  • 4,621
  • 6
  • 33
  • 53
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
38
votes
1 answer

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,582
  • 5
  • 31
  • 57
35
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
  • 371
  • 1
  • 3
  • 3
34
votes
1 answer

MBean persistence

I have a problem with persistence of my config MBean. My configuration:
Jakub C
  • 575
  • 1
  • 5
  • 14
34
votes
3 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
  • 18,586
  • 41
  • 135
  • 234
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
  • 17,019
  • 8
  • 58
  • 98
30
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
  • 11,482
  • 33
  • 101
  • 163
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
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
  • 21,763
  • 12
  • 52
  • 94
28
votes
9 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
  • 313
  • 1
  • 3
  • 7
28
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
  • 108,756
  • 21
  • 270
  • 333
26
votes
4 answers

How to find the JMX port in a server?

I am sure I can figure it out if I can see the JAVA OPTS parameters. I want to monitor a hornetq server using Jconsole, so I need the port number. I remember using some command like java grep etc when I connected to it a while back.
user244333
26
votes
4 answers

Measuring Java execution time, memory usage and CPU load for a code segment

For a particular segment of Java code, I'd like to measure: Execution time (most likely thread execution time) Memory usage CPU load (specifically attributable to the code segment) I'm a relative Java novice and am not familiar with how this might…
Jon Cram
  • 15,309
  • 21
  • 72
  • 105
25
votes
8 answers

Debugging JConsole Connection Failed

I have a web application deployed to a remote resin server, and it has JMX turned on. I can telnet to the remote server i.e franz@see:/tmp$ telnet 5555 Trying ... Connected to . Escape character is…
Franz See
  • 3,025
  • 2
  • 38
  • 47