JMX Exporter
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Rules

HTTP mode rules that apply to both the JMX Exporter Java agent and Standalone JMX Exporter.

NameDescription
startDelaySecondsstart delay before serving requests. Any requests within the delay period will result in an empty metrics set.
lowercaseOutputNameLowercase the output metric name. Applies to default format and name. Defaults to false.
lowercaseOutputLabelNamesLowercase the output metric label names. Applies to default format and labels. Defaults to false.
includeObjectNamesA list of ObjectNames to query. Defaults to all mBeans.
excludeObjectNamesA list of ObjectNames to not query. Takes precedence over includeObjectNames. Defaults to none.
autoExcludeObjectNameAttributesWhether to auto exclude ObjectName attributes that can’t be converted to standard metrics types. Defaults to true.
excludeObjectNameAttributesA Map of ObjectNames with a list of attribute names to exclude. ObjectNames must be in canonical form. Both ObjectNames and attribute names are matched as a Strings (no regex.) Optional.
includeObjectNameAttributesA Map of ObjectNames with a list of attribute names to include. ObjectNames must be in canonical form. Both ObjectNames and attribute names are matched as a Strings (no regex.) Optional.
rulesA list of rules to apply in order, processing stops at the first matching rule. Attributes that aren’t matched aren’t collected. If not specified, defaults to collecting everything in the default format.
patternRegex pattern to match against each bean attribute. The pattern is not anchored. Capture groups can be used in other options. Defaults to matching everything.
attrNameSnakeCaseConverts the attribute name to snake case. This is seen in the names matched by the pattern and the default format. For example, anAttrName to an_attr_name. Defaults to false.
nameThe metric name to set. Capture groups from the pattern can be used. If not specified, the default format will be used. If it evaluates to empty, processing of this attribute stops with no output. An Additional suffix may be added to this name (e.g _total for type COUNTER)
valueValue for the metric. Static values and capture groups from the pattern can be used. If not specified the scraped mBean value will be used.
valueFactorOptional number that value (or the scraped mBean value if value is not specified) is multiplied by, mainly used to convert mBean values from milliseconds to seconds.
labelsA map of label name to label value pairs. Capture groups from pattern can be used in each. name must be set to use this. Empty names and values are ignored. If not specified and the default format is not being used, no labels are set.
helpHelp text for the metric. Capture groups from pattern can be used. name must be set to use this. Defaults to the mBean attribute description, domain, and name of the attribute.
cacheWhether to cache bean name expressions to rule computation (match and mismatch). Not recommended for rules matching on bean value, as only the value from the first scrape will be cached and re-used. This can increase performance when collecting a lot of mbeans. Defaults to false.
typeThe type of the metric, can be GAUGE, COUNTER or UNTYPED. name must be set to use this. Defaults to UNTYPED.

Metric names and label names are sanitized. All characters other than [a-zA-Z0-9:_] are replaced with underscores, and adjacent underscores are collapsed. There’s no limitations on label values or the help text.

A minimal config is {}, which will connect to the local JVM and collect everything in the default format. Note that the scraper always processes all mBeans, even if they’re not exported.

Notes

Both whitelistObjectNames and blacklistObjectNames are still supported for backward compatibility, but should be considered deprecated.

Pattern input

The format of the input matches against the pattern is

domain<beanpropertyName1=beanPropertyValue1, beanpropertyName2=beanPropertyValue2, ...><key1, key2, ...>attrName: value
PartDescription
domainBean name. This is the part before the colon in the JMX object name.
beanPropertyName/ValueBean properties. These are the key/values after the colon in the JMX object name.
keyNIf composite or tabular data is encountered, the name of the attribute is added to this list.
attrNameThe name of the attribute. For tabular data, this will be the name of the column. If attrNameSnakeCase is set, this will be converted to snake case.
valueThe value of the attribute.

No escaping or other changes are made to these values, with the exception of if attrNameSnakeCase is set. The default help includes this string, except for the value.

Default format

The default format will transform beans in a way that should produce sane metrics in most cases. It is

domain_beanPropertyValue1_key1_key2_...keyN_attrName{beanpropertyName2="beanPropertyValue2", ...}: value

If a given part isn’t set, it’ll be excluded.

Complex YAML Configuration Examples

Integration tests provide complex/concrete examples of application and YAML configuration files.