JMX extensions are defined by JSON files.
An extension definition consists of three main elements: metadata
, metrics
, and UI
.
The basic format is as follows:{"version": "1.0","name": "custom.jmx.hornetq","type": "JMX","entity": "PROCESS_GROUP_INSTANCE","metricGroup": "tech.HornetQ","configUI" : {"displayName": "HornetQ JMX"},"metrics": [ ],"ui": {"keycharts" : [ ],"charts": [ ]}}
Each JMX extension has the following mandatory properties:
version
d.dd
, must be updated whenever the extension definition is updatedname
custom.jmx.name
rule. You can only user letters, numbers, and "-", "_" characters. For example, custom.jmx.newPlugin-Ver2
type
JMX
entity
PROCESS_GROUP_INSTANCE
metricGroup
configUI.displayName
This part of the JSON defines which metrics are collected by the extension. Each metric is defined by JSON in a format similar to the following:
{"timeseries": {"key": "Queue.ConsumerCount","unit": "Count","displayname": "Queue Consumer Count","dimensions": ["rx_pid"]},"alert_settings": [{"alert_id": "too_many_consumers","event_type": "PERFORMANCE_EVENT","event_name": "Too many consumers","description": "The {metricname} of {severity} is {alert_condition} the threshold of {threshold}","threshold": 35.0,"alert_condition": "ABOVE","samples":5,"violating_samples":3,"dealerting_samples":5,"value_extractor": "MAX"}],"source": {"domain": "org.hornetq","keyProperties": {"type": "Queue"},"attribute": "ConsumerCount"}}
This part specifies the metadata of a metric.
key
unit
dimensions
rx_pid
at index 0
. This ensures that JMX attributes get the system process ID (PID) as a dimension. Additional dimensions can be used to, for example, provide one metric per JMX ObjectName
key property value (for example, QueueName
, ThreadPoolName
, or ConnectionPoolName
). Only letters, numbers, and "-" , "_" characters are allowed.displayname
Available units:
NanoSecond
, MicroSecond
, MilliSecond
, Second
, Byte
, KiloByte
, MegaByte
, BytePerSecond
, BytePerMinute
, KiloBytePerSecond
, KiloBytePerMinute
, MegaBytePerSecond
, MegaBytePerMinute
, Count
, PerSecond
, PerMinute
This part specifies the configuration of one or more alerts for a given timeseries.
alert_id
event_type
PERFORMANCE_EVENT
, ERROR_EVENT
, AVAILABILITY_EVENT
.description
{threshold}
the value of the custom threshold that was violated, {severity}
the violating value, {entityname}
the display name of the entity where the metric violated, {violating_samples}
the number of violating samples that led to that event, {dimensions}
a string containing the violating dimensions of the metric, {alert_condition}
a string showing if above or below threshold is alertingevent_name
threshold
alert_condition
samples
violating_samples
dealerting_samples
value_extractor
MIN
, MAX
, SUM
, COUNT
, AVG
, MEDIAN
, P90
. Default value is AVG
This part specifies how a metric is collected using JMX. The following attributes are required for all metrics:
domain
keyProperties
*
)attribute
Optional attributes are:
allowAdditionalKeys
calculateDelta
calculateRate
aggregation
Splittings can be used to define an additional dimension for a metric. This dimension must be defined in the dimension
property of the timeseries and the splitting
property of the source.
"splitting": {"name": "name","type": "keyProperty","keyProperty": "name"}
To define multiple splittings, use the following format:
"splittings":[{"name":"name","type":"keyProperty","keyProperty":"name"},{"name":"context","type":"keyProperty","keyProperty":"context"}]
The following attributes must be present for each splitting:
name
type
keyProperty
keyProperty
ObjectName
of an MBean is used for splitting.The following example shows how to define a metric that provides multiple timeseries within a single metric:
{"timeseries": {"key": "XY.Size","unit": "Count","displayname": "Queue Consumer Count","dimensions": ["rx_pid","name"]}"source": {"domain": "com.sample","keyProperties": {"type": "XY","name": "*"},"attribute": "Size","splitting": {"name": "name","type": "keyProperty","keyProperty": "name"}}}
For example, MBeans com.sample:type=XY,name=A and com.sample:type=XY,name=B
will result in two timeseries, the first for "A" and the second for "B".
To extract values of individual keys returned as CompositeData
type by an attribute, you need to use the attributePath
mechanism and point to the key you're interested in.
For example, let's say you want to extract the value of used
from the HeapMemoryUsage
attribute. HeapMemoryUsage
is a CompositeData
type that returns the following list of value-key pairs:
{committed: integer,init: integer,max: integer,used: integer}
Define the metric that points to the MBean with the HeapMemoryUsage
attribute and, in the source
section, point the attributePath
to the used
key. For example:
"source": {"domain": "java.lang","keyProperties": {"type": "Memory",},"attribute": "HeapMemoryUsage","attributePath": "get(\"used\")"}
This part of the JSON defines how metrics are charted on the process page. It contains a mandatory charts section and an optional keycharts section. Each section has the same format and looks like this:
{"ui": {"keymetrics" : [{"key" : "requestCount","aggregation" : "avg","mergeaggregation" : "sum","displayname" : "Requests"}],"keycharts" : [ ],"charts": [ ]}}
The keymetrics
section is completely optional and allows you to define up to two metrics that should be part of the Process infographic. It has the following attributes:
key
aggregation
mergeaggregation
displayname
Each chart section has the same format and looks like this:
{"group": "Section Name","title": "Chart Name","series": [{"key": "MetricName","aggregation": "avg","displayname": "Display name for metric","seriestype": "area"},{"key": "Other Metric Name","aggregation": "avg","displayname": "Display name for metric","color": "rgba(42, 182, 244, 0.6)","seriestype": "area"}]}
The charts section describes how to chart each metric in the details section of the process page (available by selecting Further details).
Both sections allow an array of charts to be defined. A chart has the following required attributes:
group
title
series
A series has the following attributes:
key
displayname
aggregation
SUM
, AVG
, MIN
, MAX
mergeaggregation
color
seriestype
line
, area
, and bar
rightaxis
stacked