Open tenutensing opened 2 years ago
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
:
-javaagent
parameter. Then jmx_exporter
can access JMX beans directly and does not need remote JMX access.jmx_exporter
connects to the application via remote JMX, and the application needs the com.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])
.
Hi to get the JDBC connection pool metrics of weblogic we have to use the following mbean instead of the one that mentioned on the example config.
com.bea
so the whitelist object will be:
- "com.bea:ServerRuntime=*,Type=JDBCOracleDataSourceRuntime,*"
and the rule will be like as follows:
- pattern: "^com.bea<ServerRuntime=(.+), Name=(.+), Type=(.+)Runtime><>(.+):"
name: weblogic_$3_$4
attrNameSnakeCase: true
labels:
runtime: $1
name: $2
metrics will be like as below:
weblogic_jdbcoracledatasource_curr_capacity{name="dbname",runtime="managedserver",} 3.0 weblogic_jdbcoracledatasource_active_connections_current_count{name="dbname",runtime="managedserver",} 2.0
@Nirzak Thanks for the information!
@tenutensing @sudersank please try @Nirzak's suggestion. The exporter configuration files are examples.
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://jmx_prometheus_javaagent-0.16.1.jar=25031://config.yaml -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder”
WebSphere configuration – “-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -javaagent://jmx_prometheus_javaagent-0.16.1.jar=25031://config.yaml"”
Tomcat configuration – ““-javaagent://jmx_prometheus_javaagent-0.16.1.jar=25031://config.yaml”
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