Skip to content

Prometheus scrape (prometheus) ​

Fetches the text exposition of a Prometheus exporter (/metrics) and turns the series you select into channels. A selection names a metric and label matchers, like a Prometheus selector, and says what to do when several series match. A counter can be reported as a rate.

Channels ​

KeyNameUnitDefault limits
scrape_msScrape timemswarning above 5000
series_totalSeries in the responsenonenone
one per entry of selectits name, or its keyits unit, or the one the metric name impliesnone. Set limits on the sensor.

Parameters ​

ParameterDefaultMeaning
schemehttphttp or https.
port80 or 443TCP port. Exporters use their own: set it (9100 for node_exporter).
path/metricsRequest path and query.
verify_tlstrueCheck the server certificate.
tls_fingerprintnoneTrust exactly the certificate with this SHA-256 fingerprint (colon-separated or plain hex, either case) and no other, whatever its chain, dates or name say; verify_tls is then not needed. See pinning a certificate.
headersnoneExtra request headers. Not for credentials.
authnone{"type": "bearer"} sends the secret credential as a bearer token. basic and header also work, see HTTP content.
selectrequired1 to 50 selections, below.
max_body_bytes4194304The most response body to read, 1024 to 16777216. A larger response fails the poll.

A selection:

FieldDefaultMeaning
keyrequiredThe channel key: lower case letters, digits and _, at most 40 characters. History is stored under it, so do not change it. scrape_ms and series_total are reserved.
metricrequiredThe metric name, for example node_load1. Histogram and summary lines are series of their own, for example request_duration_seconds_bucket with le.
labelsnoneMatchers: {"label": "mountpoint", "op": "eq", "value": "/"}. op is eq, ne, re or nre; the regular expressions are anchored, as in PromQL. At most 8.
aggregatesingleWhat to do when several series match. single demands exactly one and makes the sensor Down otherwise, so a label that changes meaning is noticed. sum, min, max, avg and count combine them.
ratefalseReport the increase per second since the previous scrape instead of the value. The first scrape, and a scrape after the counter went down (a reset), give an unknown value.
scale1The value is multiplied by this, after the rate.
requiredtrueA series that is missing makes the sensor Down. With false the channel is just unknown.
namethe keyThe name shown for the channel, up to 80 characters.
unitsee belowThe unit of the reported value, for example ms, B, %, s.

Names and units ​

The template cannot know a selection's channel, so its name and unit come from the selection itself, before any poll: name (the key if it is missing) and unit. When unit is missing and scale is 1, Probeward uses the unit that Prometheus' naming conventions give the metric: _bytes is B (a rate of a _bytes or _bytes_total metric is B/s), _seconds is s, _celsius is °C and _percent is %. With a scale, a count aggregate or any other rate, nothing is implied and the channel has no unit unless you give one: you changed what the number means. seconds, milliseconds, bytes, percent and celsius are read as s, ms, B, % and °C, which the interface formats as times and sizes; any other unit is shown as written. Names and units are shown as plain text, and the key stays the channel's identity.

Suggested interval: 60 seconds. Credential: an optional secret, used when auth is set.

NaN and infinite values are unknown. Rates need the previous value, which is kept in the sensor's state; if you forget the state the next rate is unknown again.

Limits ​

The response may not be larger than max_body_bytes, and may not hold more than 100000 series. Both are failures, not partial reads: a half-read endpoint would give wrong numbers. For a big exporter, scrape a path that exposes less, or put a filtering proxy in front.

The classic text format and the text form of OpenMetrics (exemplars and timestamps are tolerated, # EOF is ignored) are read. The protobuf format is not. Metric names in quotes (the newer UTF-8 form) are not read.

Failures ​

MessageMeaning
no series matches <metric>Down. The exporter works, the series is not there.
N series match <metric>; narrow the label matchers or choose an aggregateDown.
the response holds no metrics (is this a Prometheus endpoint?) (kind protocol)The body is not exposition text.
the response is larger than N bytes / more than 100000 series (kind protocol)A limit.
the server answered HTTP 401 (kind auth_failed)The token is wrong.

Verification ​

It has not been run against every exporter; text that follows the format should work.

AGPL-3.0-only