jmx_exporter
jmx_exporter copied to clipboard
JDBC connection pool metrics are not getting scraped via JMX exporters
Hi there,
JDBC connection pool metrics are not getting scraped via JMX exporters. Configured JMX exporter in both WebLogic, WebSphere and Tomcat. In all 3 cases, scraped metrics doesn’t show up JDBC connection pool metrics.
I’m trying to scrape the JDBC metrics like - https://docs.oracle.com/cd/E25178_01/apirefs.1111/e13952/pagehelp/JDBCjdbcdatasourcesjdbcdatasourcemonitorstatisticstitle.html
Can somebody help me to figure out the configurations to be done if any, in order to expose the JDBC connection pool via JMX exporters?
JMX version – jmx_prometheus_javaagent-0.16.1.jar Java version – 1.8.0_251 WebLogic Server version – 12.2.1.4.0 WebSphere Server version – 9.0.5.6 Tomcat Server version - 8.5.66
WebLogic configuration – “-javaagent:/
WebSphere configuration – “-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -javaagent:/
Tomcat configuration – ““-javaagent:/
Tried with below “config.yaml” contents first. As per my understanding, all the default metrics will get scrapped, if we do not blacklist or whitelist any objects.
startDelaySeconds: 0 ssl: false lowercaseOutputName: false lowercaseOutputLabelNames: false
Above configuration, didn’t scrape the JDBC metrics. Hence tried whitelisting "com.bea:ServerRuntime=,Type=JDBCDataSourceRuntime,", but this too was not fruitful (https://github.com/prometheus/jmx_exporter/blob/master/example_configs/weblogic.yml).
Regards, Tenu
Hello, I also encountered this problem, has this problem been solved?
@sbadyjy Not yet.
@tenutensing were you able to solve this pls?. using jboss eap and not able to scrap the jdbc connection pool metrics.
@sudersank No. It's not working with this exporter OOTB.
Thank you for the response. is there any workaround that you are aware of to get the metrics. thanks in advance
@sudersank Unfortunately no.
I guess there is a misunderstanding how jmx_exporter accesses JMX beans. There are two ways to run jmx_exporter:
- As a Java agent. You attach it to a JVM at startup using the
-javaagentparameter. Thenjmx_exportercan access JMX beans directly and does not need remote JMX access. - As a standalone HTTP server. Then
jmx_exporterconnects to the application via remote JMX, and the application needs thecom.sun.management.jmxremote...parameters to expose JMX on a TCP port.
In the example you are using both, -javaagent and JMX remote, this should not be needed at all.
There 1 way to get the metrics. dbPoolName can be any name you want.
ObjectName objectName = new ObjectName( "com.nv:type=DataSource" + ",name=" + this.dbPoolName);
/*
* MEMO: register datasource into jmx.
* ref: https://tomcat.apache.org/tomcat-8.5-doc/jdbc-pool.html#JMX
* preRegister() -> registerJmx()
*/
datasource.preRegister(null, objectName);
logger.log(Level.INFO, "jmx register success, objectName : " + objectName);
I don't know how it looks like on WebLogic, but on Tomcat I get metrics like Catalina_DataSource_NumActive or Catalina_DataSource_BorrowedCount. Metrics like "Active Connections Average Count" or "Active Connections High Count" from the document you linked can be calculated later directly inside Prometheus, e.g. avg_over_time(Catalina_DataSource_numActive{name="\"jdbc/default\""}[1m]) or max_over_time(Catalina_DataSource_numActive{name="\"jdbc/default\""}[1m]).