Adjustment and options of the configuration

Since the ImageMaster JMX Exporter is derived from the publicly available JMX Exporter, the following information is based on the related GitHub source [GitHub-JMX_Exporter]:

The complete configuration is specified in a YAML file. You can use the predefined configuration located in the folder “example_configs” with minimal changes. This file can be adjusted according to your needs. See an example below with all possible options described in ImageMaster JMX Exporter – options overview:

---
startDelaySeconds: 0
hostPort: 127.0.0.1:1234
username: <place here encoded username>
password: <place here encoded password>
jmxUrl: service:jmx:rmi:///jndi/rmi://127.0.0.1:1234/jmxrmi
ssl: false
lowercaseOutputName: false
lowercaseOutputLabelNames: false
whitelistObjectNames: ["org.apache.cassandra.metrics:*"]
blacklistObjectNames: ["org.apache.cassandra.metrics:type=ColumnFamily,*"]
rules:
  - pattern: 'org.apache.cassandra.metrics<type=(\w+), name=(\w+)><>Value: (\d+)'
    name: cassandra_$1_$2
    value: $3
    valueFactor: 0.001
    labels: {}
    help: "Cassandra metric $1 $2"
    type: GAUGE
    attrNameSnakeCase: false

The following options are available:

Name

Description

startDelaySeconds

Start delay before serving requests

Any requests within the delay period will result in an empty metrics set.

hostPort

The host and port to connect to via remote JMX

If neither this nor jmxUrl is specified, the communication will be established with the local JVM.

username

The username to be used in remote JMX password authentication

password

The password to be used in remote JMX password authentication

jmxUrl

A full JMX URL to connect to

This should not be specified if hostPort is set.

ssl

Option to decide if the JMX connection should be done over SSL

To configure certificates you have to set the following system properties with your matching values for key and truststore paths and passwords:

-Djavax.net.ssl.keyStore=/home/user/.keystore

-Djavax.net.ssl.keyStorePassword=changeit

-Djavax.net.ssl.trustStore=/home/user/.truststore

-Djavax.net.ssl.trustStorePassword=changeit

lowercaseOutputName

Option to apply lower case to the output metric name

Applies to default format and name. Defaults to false.

lowercaseOutputLabelNames

Option to apply lower case to the output metric label names

Applies to default format and labels. Defaults to false.

whitelistObjectNames

A list of object names to query

Defaults to all mBeans.

blacklistObjectNames

A list of object names NOT to query

Takes precedence over whitelistObjectNames. Defaults to none.

rules

A 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.

pattern

Regular expression pattern to match against each bean attribute

The pattern is not anchored. Capture groups can be used in other options. Defaults to matching everything.

attrNameSnakeCase

Converts 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.

name

The 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.

value

Value for the metric

Static values and capture groups from the pattern can be used. If not specified, the scraped mBean value will be used.

valueFactor

Optional number that value is multiplied by

This is mainly used to convert mBean values from milliseconds to seconds. If value is not specified, the scraped mBean value is used instead.

labels

A map of label name to label value pairs

Capture groups from pattern can be used in each. The 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.

help

Help text for the metric

Capture groups from pattern can be used. The name must be set to use this. Defaults to the mBean attribute description and the full name of the attribute.

type

The type of the metric can be GAUGE, COUNTER or UNTYPED. The name must be set to use this. Defaults to UNTYPED.

Table 372: ImageMaster JMX Exporter – options overview

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 configuration 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.

Example configurations for Java agents can be found on the GitHub JMX Exporter [GitHub-JMX_Exporter] subsite:

https://github.com/prometheus/jmx_exporter/tree/master/example_configs

Pattern input

The format of the input matches against the pattern is:

domain<beanpropertyName1=beanPropertyValue1, beanpropertyName2=beanPropertyValue2, ...><key1, key2, ...>attrName: value

Part

Description

domain

Bean name

This is the part before the colon in the JMX object name.

beanProperyName/Value

Bean properties

These are the key/values after the colon in the JMX object name.

keyN

If composite or tabular data is encountered, the name of the attribute is added to this list.

attrName

The 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.

value

This is the value of the attribute.

Table 373: ImageMaster JMX Exporter – format description of input matches against pattern

No escaping or other changes are made to these values unless 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:

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

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