jmx_exporter icon indicating copy to clipboard operation
jmx_exporter copied to clipboard

How to expose mbean with specific attribute(s)

Open AttitudeL opened this issue 2 years ago • 1 comments

Hi there,

I've been struggling with selective choose the attribute that I want to expose under a single mbean. The reason is that some mbeans have way too many attributes which I don't use, exposing all of them will fill up the capacity if many services are deployed.

Currently I'm having the following config to expose jmx metrics.

lowercaseOutputName: false
whitelistObjectNames: 
  - "kafka.producer:type=producer-metrics,client-id=*"
  ......

As you can see that I'm exposing the kafka.producer mbean, but I'm only interested in the request-latency-avg attribute. Is it possible to expose this mbean with one or more attributes that I chose?

Thanks in advance.

AttitudeL avatar Mar 04 '22 20:03 AttitudeL

Same issue here, I couldn't find a way to expose a specific attribute. Does JMX Exporter offer this capability?

dalbani avatar May 30 '22 09:05 dalbani

Currently, there is no per MBean attribute filtering. This sounds like a great enhancement!

dhoard avatar Jun 24 '23 03:06 dhoard

@AttitudeL @dalbani I just create a PR (https://github.com/prometheus/jmx_exporter/pull/870) to allow MBean attribute exclusion filtering.

Can you all review the enhancement to see if it satisfies your requirements?

dhoard avatar Aug 05 '23 18:08 dhoard

@AttitudeL @dalbani I just create a PR (https://github.com/prometheus/jmx_exporter/pull/870) to allow MBean attribute exclusion filtering.

Can you all review the enhancement to see if it satisfies your requirements?

Wow thank you so much for adding this great enhancement. When I'm back home I will review the change.

AttitudeL avatar Aug 05 '23 18:08 AttitudeL

Adding code to allow attribute filtering by ObjectName and attribute name.

dhoard avatar Aug 08 '23 00:08 dhoard