prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't add metrics to blacklistObjectNames

rus-99-pk opened this issue · comments

Hello!

I have JMX metrics:

...
artemis_address_size_bytes{address="Queue.PlannedEvent.DeleteAllPEQueue",} 0.0
artemis_address_size_bytes{address="Queue.PlannedEvent.PEByRuleCreateMessage",} 0.0
artemis_address_size_bytes{address="Queue.EventAction.Notifications",} 0.0
artemis_address_size_bytes{address="ExpiryQueue",} 0.0
artemis_address_size_bytes{address="Queue.PlannedEvent.AddPlannedEventMessages",} 0.0
...

and config:

---
lowercaseOutputName: true
lowercaseOutputLabelNames: true

whitelistObjectNames:
  - "org.apache.activemq.artemis:*"
blacklistObjectNames:
  - "org.apache.activemq.artemis:name=artemis_address_size_bytes,type=GAUGE,address=Queue.PlannedEvent*,*"

rules:
  - pattern: 'org.apache.activemq.artemis<broker="\S+", component=addresses, address="(\S+)"><>AddressSize:'
    name: artemis_address_size_bytes
    type: GAUGE
    labels:
      address: $1
    help: The number of estimated bytes being used by the queue(s), used to control paging and blocking
...

I try to add metrics with address="Queue.PlannedEvent.*" to blacklistObjectNames but it doesn't work. Metrics are still showing.

Help me please, what's my mistake?

@rus-99-pk remove type=GAUGE, from your blacklistObjectNames value.

@dhoard, thank you for reply. But it doesn't work.

I'm still getting:

...
artemis_address_size_bytes{address="Queue.PlannedEvent.DeleteAllPEQueue",} 0.0
artemis_address_size_bytes{address="Queue.PlannedEvent.PEByRuleCreateMessage",} 0.0
artemis_address_size_bytes{address="Queue.EventAction.Notifications",} 0.0
artemis_address_size_bytes{address="ExpiryQueue",} 0.0
artemis_address_size_bytes{address="Queue.PlannedEvent.AddPlannedEventMessages",} 0.0
...

@rus-99-pk Are you sure artemis_address_size_bytes is the actual MBean ObjectName? (it doesn't look correct to me)

Can you use JConsole to verify the MBean name?

@dhoard, thank you for the tip! I checked your offer in JConsole:

изображение

And write ObjectName value to config:

...
whitelistObjectNames:
  - "org.apache.activemq.artemis:*"
blacklistObjectNames:
  - "org.apache.activemq.artemis:broker=0.0.0.0,component=addresses,address=Queue.PlannedEvent"
...

and it still doesn't work, because i'm still getting:

...
artemis_address_size_bytes{address="Queue.PlannedEvent",} 0.0
...

@rus-99-pk Looking ObjectName value and blacklistObjectNames values... they don't match.

The ObjectName has double quotes... the blacklistObjectNames does not.

        ObjectName objectName1 = new ObjectName("org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Queue.PlannedEvent\"");
        ObjectName objectName2 = new ObjectName("org.apache.activemq.artemis:broker=0.0.0.0,component=addresses,address=Queue.PlannedEvent");

        System.out.println(objectName1);
        System.out.println(objectName2);
        System.out.println("equal = " + objectName1.equals(objectName2));
org.apache.activemq.artemis:broker="0.0.0.0",component=addresses,address="Queue.PlannedEvent"
org.apache.activemq.artemis:broker=0.0.0.0,component=addresses,address=Queue.PlannedEvent
equal = false

@dhoard, thank you so much! I thought it didn't matter, but it doesn't.

I changed my config:

...
whitelistObjectNames:
  - "org.apache.activemq.artemis:*"
blacklistObjectNames:
  - "org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Queue.PlannedEvent*\",*"
...

And it works now! Thanks again.