Exporters & the Pushgateway
|
This section documents the current Prometheus 3.x line (latest 3.14.0) as published at the Prometheus documentation and the current Grafana 13.x line (latest 13.2.1) as published at the Grafana documentation, which are the references these pages are written and verified against. No specific patch version is pinned. Some capabilities (Grafana Enterprise-only features, Grafana Cloud-hosted services, and long-term-storage systems like Thanos/Cortex/Mimir) are linked, not documented in depth. This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production, since both projects iterate quickly. This section’s bibliography lists the reference material consulted while preparing these pages. |
An exporter bridges a system that does not natively speak Prometheus’s format into one that does:
it runs as its own process, exposes a /metrics HTTP endpoint, and translates whatever it knows
about a third-party system into Prometheus’s text exposition format on every scrape. This page covers
the two most widely deployed exporters — node_exporter for host metrics and blackbox_exporter for
active probing — the general shape of a custom exporter, and the Pushgateway, which exists for a
narrow case that pull-based scraping cannot cover on its own. The full catalog of first-party and
community exporters is
Exporters & integrations; getting node_exporter
running for the first time is covered in
Getting Started. Database-specific community exporters follow
the same shape — for example redis_exporter, covered from the Redis side in
Administration, Monitoring &
Troubleshooting.
node_exporter: host-level metrics
node_exporter exposes kernel and hardware metrics for the machine it runs on — CPU, memory,
filesystems, disks, network interfaces — by reading /proc and /sys on Linux (with narrower
support for other Unix-likes). Each metric family comes from an independent collector, and most
collectors are on by default:
| Collector | What it reports |
|---|---|
|
Per-CPU, per-mode time in |
|
Parsed |
|
Per-mountpoint size and free space ( |
|
Per-block-device I/O counters ( |
|
Per-interface traffic counters ( |
|
The classic 1/5/15-minute load averages. |
|
A single info metric with kernel/architecture labels. |
Collectors are toggled with --collector.<name> / --no-collector.<name> flags at startup; a handful
(for example textfile, covered below) default to off instead:
# Disable a noisy or irrelevant collector, and turn on the textfile collector
# pointed at a directory of *.prom files dropped there by cron jobs or scripts.
./node_exporter \
--no-collector.wifi \
--collector.textfile.directory=/var/lib/node_exporter/textfile_collector
# https://github.com/prometheus/node_exporter
The textfile collector is the escape hatch for anything node_exporter does not natively read:
a cron job writes plain exposition-format lines to a .prom file in the watched directory, and
node_exporter folds them into its own /metrics output on the next scrape — no separate HTTP
endpoint needed for that data. The full collector list, their default on/off state, and each metric’s
name and labels are documented in the project’s own reference, not duplicated here:
node_exporter.
blackbox_exporter: probing from the outside
Where node_exporter reports what a host observes about itself, blackbox_exporter reports what an
external probe observes about a target — it is the exporter to reach for when the question is "is
this endpoint reachable and responding correctly," not "what is this host’s own CPU doing." It
supports HTTP(S), TCP, ICMP, and DNS probes, each defined as a named module in its own config file:
# blackbox.yml
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_status_codes: [200]
method: GET
tcp_connect:
prober: tcp
timeout: 5s
icmp_ping:
prober: icmp
timeout: 5s
# https://github.com/prometheus/blackbox_exporter
Prometheus does not scrape blackbox_exporter directly for the target’s own metrics; it scrapes
blackbox_exporter’s `/probe endpoint, passing the real target and the module to use as query
parameters. The exporter performs the probe on the fly and returns metrics such as probe_success
(1/0) and probe_duration_seconds for that request:
scrape_configs:
- job_name: "blackbox-http"
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://example.com
- https://example.org
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9115 # the blackbox_exporter itself
# https://github.com/prometheus/blackbox_exporter
The relabel_configs block above is the standard pattern for every blackbox_exporter job: the real
target from static_configs is rewritten into a param_target query parameter, copied into the
instance label so it (not the exporter’s own address) identifies the series, and address__ is
then overwritten to point the scrape itself at blackbox_exporter. Relabeling in general is covered in
Service Discovery & Relabeling. ICMP
probing needs raw-socket privileges (CAP_NET_RAW or root) on the host running the exporter.
Writing a custom exporter
When neither an existing exporter nor direct instrumentation (covered in Instrumenting Applications) fits — typically because the system you need metrics from is a third party you cannot add a client library to — the fix is a small standalone process that follows the same shape every official exporter uses:
-
Expose a single
/metricsHTTP endpoint using a Prometheus client library. -
On each scrape, either query the target system live (a database, a REST API, an appliance) and translate its current state into metrics on the spot, or serve values a background goroutine/thread already gathered on its own schedule and cached in memory.
-
Return plain, unauthenticated text in the Prometheus exposition format — no scrape-triggered side effects beyond reading state.
The live-query-per-scrape pattern is simplest and keeps metrics as fresh as the last scrape, but it means a slow upstream call directly slows (or times out) the scrape; a background collector decouples the two at the cost of metrics that lag their own collection interval. Both are legitimate, and the choice is a per-exporter judgment call, not a Prometheus rule. The canonical guidance on this decision, naming conventions, and metric-type selection is Writing exporters.
The Pushgateway: what it is for
Every mechanism above is pull-based: Prometheus initiates the scrape, on its own schedule, and can tell a target apart from a target that has simply gone quiet. The Pushgateway is the one place this model is deliberately inverted: it is a small HTTP service that accepts pushed metrics and holds them in memory so a normal Prometheus scrape of the Pushgateway itself can still pull them out. It exists for exactly one case: short-lived batch or cron jobs that exit before any scrape could ever reach them.
# A batch job pushes its own result under the "my_batch_job" job label
# and a grouping label identifying this particular instance.
echo "my_batch_job_last_success_timestamp_seconds $(date +%s)" | \
curl --data-binary @- \
http://pushgateway:9091/metrics/job/my_batch_job/instance/db-backup-01
# https://prometheus.io/docs/instrumenting/pushing[Pushing metrics]
Prometheus then scrapes the Pushgateway like any other target:
scrape_configs:
- job_name: "pushgateway"
honor_labels: true # keep the job/instance labels the job pushed, not the scrape's own
static_configs:
- targets: ["pushgateway:9091"]
# https://prometheus.io/docs/instrumenting/pushing[Pushing metrics]
honor_labels: true is not optional in practice here: without it, Prometheus’s own relabeling would
overwrite the pushed job/instance labels with the Pushgateway’s own, collapsing every pushed job
under one identity.
When not to use it
The Pushgateway is explicitly not a general-purpose ingestion endpoint, and reaching for it out of habit breaks the properties pull-based scraping gives for free:
-
Never for regular, long-running service metrics. A normal service should expose its own
/metricsand be scraped directly — pushing to the Pushgateway instead adds a hop, a single point of failure shared by every job pushing to it, and throws away per-targetupsemantics: Prometheus sees the Pushgateway asup, not the job that pushed. -
It breaks staleness. A scraped target’s series go stale (and eventually disappear) automatically when the target stops responding. A metric pushed once to the Pushgateway is held and re-served on every subsequent scrape until something explicitly deletes it (
DELETE /metrics/job/<job>/instance/<instance>) — so a batch job that stops running silently leaves its last value looking perpetually current instead of going stale. -
It is not a queue or a buffer for high-volume or high-cardinality data — it holds the latest value per label set in memory, with no history and no aggregation.
The project’s own guidance on this boundary — and the handful of cases (short-lived batch jobs,
service-level batch metrics that no scrape could otherwise observe) it is actually meant for — is
Pushing metrics. For everything else, prefer a
directly-scraped /metrics endpoint, whether from
Instrumenting Applications or one of the
exporters on this page.
Continue with Service Discovery &
Relabeling for how scrape targets — including blackbox_exporter jobs like the one above — are
discovered and relabeled at scale, or
Containers & Kubernetes Monitoring
for running these exporters alongside workloads in a cluster.