MetricsHub
MetricsHub Community Connectors 1.0.22
-
Home
- Connector Developer Guide Detection 13
Detection by JMX
When to Use
Use jmx when connector eligibility is tied to a specific MBean/object name and attribute set. Typical usage: Java middleware and databases exposing JMX (for example Cassandra).
Syntax
connector:
detection:
criteria:
- type: jmx
objectName: org.apache.cassandra.metrics:type=Storage,name=Load
attributes:
- Count
expectedResult: ^[0-9]
Properties
| Property | Required | Default | Description |
|---|---|---|---|
type |
Yes | - | jmx. |
objectName |
Yes | - | MBean object name/pattern to query. Must be non-blank. |
attributes |
Yes | - | List of attributes read from the MBean. |
expectedResult |
No | none | Regex matched against serialized JMX result. |
errorMessage |
No | none | Connector-authored failure context (for logs/reporting). |
forceSerialization |
No | false |
Guarantees operations are performed sequentially against one host. |
Runtime Behavior
JMX query results are treated as a table (List<Map<String,String>>) and serialized as =-separated name-value pairs before matching.
- No
expectedResult: success if serialized result is non-empty. - With
expectedResult: case-insensitive regex match.
See below example on how a JMX result is converted to text before matching with expectedResult:
Criterion
- type: jmx
objectName: org.apache.cassandra.metrics:type=Storage,name=Load
attributes:
- Count
- Unit
expectedResult: Count=[0-9]+
Result
| Count | Unit |
|---|---|
| 123456 | bytes |
Result As Text
Count=123456
Unit=bytes
✅ The criterion passes because the serialized text contains a line that matches expectedResult: Count=[0-9]+.
Recommended Pattern
- Query one deterministic MBean for detection.
- Request only required attributes.
- Match stable numeric or enum-like values rather than free text.
Common Mistakes
- Using too many attributes in detection when one is enough.
- Matching volatile values (timestamps, counters with changing format).
- Confusing detection criteria with data collection monitors.
Examples
Community example — the jmx criterion of Cassandra[1], included directly from the connector source:
- type: jmx
objectName: org.apache.cassandra.metrics:type=Storage,name=Load
attributes:
- Count
expectedResult: ^[0-9]
detection
jmx
mbean
metricshub
community
connector
hardware
system
Links:
- [1] https://github.com/metricshub/community-connectors/blob/main/src/main/connector/database/Cassandra/Cassandra.yaml
Search Results for {{siteSearch | truncate:'50'}}
{{resultArray.length}}
Searching...
No results.
