You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jmx_exporter can run in an agent mode (attaching directly to the JVM to be motitored) or in a standalone mode (connecting to a remote JVM to be monitored).
If you want to connect to a remote JVM you have to configure either the jmxUrl or the hostPort.
Here's an overview of the possible configurations:
1 Running in agent mode without configuring jmxUrl or hostPort
This is as expected, if you run jmx_exporter in agent mode you don't need to connect to a remote JVM.
2 Running in standalone mode and configuring jmxUrl or hostPort
This is as expected, if you run jmx_exporter in standalone mode you want to configure the remote connection to the JVM to be monitored.
3 Running in standalone mode without configuring jmxUrl or hostPort
This is now prevented and will result in a startup error.
// If the jmxUrl configuration is missing, the JmxScraper implicitly monitors the JVM it runs in.
// This is good if the JmxCollector is used in the Java agent, because the Java agent should monitor the JVM
// it is attached to.
// However, if the JmxCollector is used in the WebServer, the intention is that it monitors another process.
// If the jmxUrl configuration is missing, it should not silently ignore this and start monitoring itself.
// The WebServer sets jmxUrlRequired to true so that we can verify this and terminate with a proper error message.
if (jmxUrlRequired && config.jmxUrl.isEmpty()) {
LOGGER.severe("configuration error: one of jmxUrl or hostPort is required");
System.exit(-1);
}
}
Previously, what happened was that jmx_exporter starts and monitors its own JVM, which is very likely not what you want.
4 Running in agent mode and configuring jmxUrl or hostPort
This is currently possible. What happens is that jmx_exporter attaches to a JVM, but instead of monitoring that JVM it tries to connect to a remote JVM to monitor.
Proposal
Modify the behavior in case 4 and make jmx_exporter terminate with an error. If you run jmx_exporter in agent mode attaching to a JVM you certainly don't want to use it to monitor a remote JVM.
The text was updated successfully, but these errors were encountered:
I agree... case 4 doesn't seem like something we would want to support.
If a user wants to run Tomcat/Jetty (or another JEE servlet container) to monitor an external application (as opposed to the built-in HTTPServer), they really should be using client_java and MetricsServlet directly.
jmx_exporter
can run in an agent mode (attaching directly to the JVM to be motitored) or in a standalone mode (connecting to a remote JVM to be monitored).If you want to connect to a remote JVM you have to configure either the
jmxUrl
or thehostPort
.Here's an overview of the possible configurations:
1 Running in agent mode without configuring jmxUrl or hostPort
This is as expected, if you run
jmx_exporter
in agent mode you don't need to connect to a remote JVM.2 Running in standalone mode and configuring jmxUrl or hostPort
This is as expected, if you run
jmx_exporter
in standalone mode you want to configure the remote connection to the JVM to be monitored.3 Running in standalone mode without configuring jmxUrl or hostPort
This is now prevented and will result in a startup error.
jmx_exporter/collector/src/main/java/io/prometheus/jmx/JmxCollector.java
Lines 101 to 112 in 5c2c921
Previously, what happened was that
jmx_exporter
starts and monitors its own JVM, which is very likely not what you want.4 Running in agent mode and configuring jmxUrl or hostPort
This is currently possible. What happens is that
jmx_exporter
attaches to a JVM, but instead of monitoring that JVM it tries to connect to a remote JVM to monitor.Proposal
Modify the behavior in case 4 and make
jmx_exporter
terminate with an error. If you runjmx_exporter
in agent mode attaching to a JVM you certainly don't want to use it to monitor a remote JVM.The text was updated successfully, but these errors were encountered: