String attributenames are ignored and not exported

37 views
Skip to first unread message

Rip Jal

unread,
Mar 5, 2021, 12:28:14 PM3/5/21
to Prometheus Users
This looks like to be an issue 

I have activemq Mbean which has attribute currentStatus whose value is returned as Good.
Exact MbeanObject is "org.apache.activemq:type=Broker,brokerName=myBroker01,service=Health"
Looks like in JMXCollector.Receiver.recordBean,it is only storing value if it is a number or Boolean else it is ignoring and returning from there and then.
Below is the code snippet from JMXCollector
if (beanValue instanceof Number) { value = ((Number) beanValue).doubleValue() * matchedRule.valueFactor; } else if (beanValue instanceof Boolean) { value = (Boolean) beanValue ? 1 : 0; } else { LOGGER.fine("Ignoring unsupported bean: " + beanName + attrName + ": " + beanValue); return; }

Is there any reason to do so ?Is jmx_exporter not expected to be returning string ?

If there is any alternative to get this metric out?

Matthias Rampke

unread,
Mar 6, 2021, 3:35:49 AM3/6/21
to Rip Jal, Prometheus Users
The Prometheus data model only has float values (this makes the highly compact storage possible), so the exporter has no way to represent "Good", "Bad", or "lily-of-the-valley" without further help from you.

Can you write a pair of mapping rules for the exporter that match on the possible beanPropertyValue and set a fixed metric value of 1 or 0?

/MR

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/1d46ce80-8787-4bfa-8ec8-6e36f6a688e9n%40googlegroups.com.

Rip Jal

unread,
Mar 7, 2021, 9:46:22 PM3/7/21
to Prometheus Users
Thanks Mat. 
Mapping rules alongwith values did work.I used below rules to achieve this
  - pattern: "org.apache.activemq<type=Broker, brokerName= myBroker01 , service=Health><>CurrentStatus: Good"
    value: 1
  - pattern: "org.apache.activemq<type=Broker, brokerName= myBroker01 , service=Health><>CurrentStatus: *"
    value: 0

Reply all
Reply to author
Forward
0 new messages