openMetrics PMDA (OpenMetrics PMDA)
METADATA
Metric data returned by URL or scripted configuration files may
contain metadata that can be used by the openmetrics
PMDA to
specify the semantics, data type, scaling and units of
dynamically created metrics. This metadata is prefixed with #
PCP5
or # PCP
in the ingested metric data. For additional
information about PCP metadata, see pmLookupDesc(3) and
pmParseUnitsStr(3) and examples in shipped configuration files.
In-line "PCP5" metadata must be supplied by the metrics source
end-pont (URL or script). An alternative is to specify this in
the URL configuration file directly, which has the advantage of
not having to modify the source/end-point if the metadata is
incorrect or missing. Metadata specified in the URL
configuration file over-rides any in-line metadata.
The configuration file syntax for specifying metadata is:
METADATA:
regex type indom semantics units ... to EOL
Where:
METADATA:
is literal
regex is an extended regular expression to match one or more
metric names returned by the URL,
type is one of the PCP numeric types (32
, u32
, 64
, u64
, float
or
double
),
indom is an arbitrary instance domain name, or PM_INDOM_NULL
,
semantics is either counter
, instant
or discrete
and
units is either none
or a string extending to end of line that is
parseable by pmParseUnitsStr(3), i.e. the units, dimensions and
scaling to be used for matching metrics.
An example configuration file that ingests metrics from the
Grafana /metrics end-point on localhost, filters out all metrics
returned by that URL except for grafana_api_response_status_total
and then specifies the metric type is an unsigned 32 bit integer
with a non-singular instance domain named response
and counter
semantics with units of count
.
http://localhost:3000/metrics
FILTER: INCLUDE METRIC grafana_api_response_status_total
FILTER: EXCLUDE METRIC .*
METADATA: grafana_api_response_status_total u32 response counter
count
Note that the name in the indom field is presently ignored unless
it is PM_INDOM_NULL
, in which case the metric has no instance
domain (i.e. singular), even if it has labels which would
otherwise be used for instance naming.