prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption
Apache License 2.0
2.97k stars 1.19k forks source link

Add basic support for arrays #377

Open zeeke opened 5 years ago

zeeke commented 5 years ago

I'm trying to configure an exporter for ActiveMQ and I thinks some array attributes can be useful as exported metric:

The attributes I'm interested on are:

and the object type is (as reported by VisualVM): javax.management.ObjectName[205]

These object aren't supported by the exporter, as stated in: https://github.com/prometheus/jmx_exporter/blob/master/collector/src/main/java/io/prometheus/jmx/JmxScraper.java#L273

Please think if a simple array length can be extracted as a metric for this kind of objects. If there aren't any better plan to manage arrays, it's better than nothing.

I can work on a PR if needed.

brian-brazil commented 4 years ago

I'd like to see a few other uses rather than supporting the first use case we come across.

MalKeshar commented 2 years ago

I will add one more case. We are using jmx+zabbix to monitor complex java metrics. Some zabbix triggers involved value of -XX:MinMetaspaceExpansion/ -XX:MaxMetaspaceExpansion.

For example we have such metaspace trigger

Name: No memory for next Metaspace expansion Expression: Usage.committed >= Usage.max - MinMetaspaceExpansion

Values of MinMetaspaceExpansion/MaxMetaspaceExpansion are accessible by jmx only in mbea "java.lang.Runtime InputArguments" which is array, currently not supported by jmx_exporter. So for now we are using custom zabbix item which retrieve their values from java process arguments, which is way more hacky

rotem-ad commented 2 years ago

I'd really appreciate array support as well. I've configured JMX exporter for scraping Debezium MySQL Connector JMX metrics.

Specifically I'm interested in the following attribute: debezium.mysql:type=connector-metrics,context=streaming,server=.CapturedTables which is of String[] type. You can its description here

AFAIU it's currently unsupported: https://github.com/prometheus/jmx_exporter/blob/master/collector/src/main/java/io/prometheus/jmx/JmxScraper.java#L284

Could be really useful :)

Thiago-Dantas commented 2 years ago

I'm also using Debezium but for me a really useful metric would be to calculate the progress % of the snapshot

Debezium exposes the current PK ids being snapshoted, and the last PK ids to be snapshoted, but since a database table may have multiple columns in a PK, the JMX value is an array of Ids, so unfortunately not exported to prometheus

dhoard commented 11 months ago

@zeeke I'm sure you have moved on from this issue, given it it's over 4 years old, but had some questions.

Looking at the ActiveMQ MBean reference (https://activemq.apache.org/jmx.html) it appears that some of the attributes should be simple numerics.

Are these being exported?