prometheus/jmx_exporter

Inconsistency in WebLogic MBean Retrieval Between JMX Exporter Versions 0.17.2 and 1.0.1

Sophisycho opened this issue · 2 comments

Hi JMX Exporter team,

I've been using your project for WebLogic monitoring and noticed something strange between versions 0.17.2 and 1.0.1. In 0.17.2, I can retrieve WebLogic MBeans without needing to add the following JVM argument:

-Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder

But when I switched to version 1.0.1, I had to add this option for the MBeans to show up. It seems odd since I thought this option was supposed to be mandatory across all versions.

Could you shed some light on why this is happening? Is this an intentional change in newer versions, or is there something else going on?

Thanks in advance for any clarification!

Best regards

@Sophisycho I'm unaware of any changes in the exporter code that would change the behavior.

Looking at the relevant code in 0.17.2 and 1.0.1 the only change was to allow RMI to the registry without SSL...

0.17.2

if (jmxUrl.isEmpty()) {
beanConn = ManagementFactory.getPlatformMBeanServer();
} else {
Map<String, Object> environment = new HashMap<String, Object>();
if (username != null && username.length() != 0 && password != null && password.length() != 0) {
String[] credent = new String[] {username, password};
environment.put(javax.management.remote.JMXConnector.CREDENTIALS, credent);
}
if (ssl) {
environment.put(Context.SECURITY_PROTOCOL, "ssl");
SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory);
environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
}
jmxc = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment);
beanConn = jmxc.getMBeanServerConnection();

1.0.1

if (jmxUrl.isEmpty()) {
beanConn = ManagementFactory.getPlatformMBeanServer();
} else {
Map<String, Object> environment = new HashMap<>();
if (username != null
&& username.length() != 0
&& password != null
&& password.length() != 0) {
String[] credent = new String[] {username, password};
environment.put(javax.management.remote.JMXConnector.CREDENTIALS, credent);
}
if (ssl) {
environment.put(Context.SECURITY_PROTOCOL, "ssl");
SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
environment.put(
RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE,
clientSocketFactory);
if (!"true".equalsIgnoreCase(System.getenv("RMI_REGISTRY_SSL_DISABLED"))) {
environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
}
}
jmxc = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment);
beanConn = jmxc.getMBeanServerConnection();

@Sophisycho I suspect it's related to #128

I would try using startDelaySeconds.

This will delay initial metrics collection/prevent calls to ManagementFactory.getPlatformMBeanServer() in scenarios where a custom MBeanServer implementation is being used.