An exporter is a program that collects metrics from a system that does not expose Prometheus metrics itself, such as an operating system, database or hardware device, and translates them into the Prometheus exposition format. It serves them on an HTTP endpoint, usually /metrics, where Prometheus or a compatible agent scrapes them.
What is a Prometheus exporter?
An exporter is a bridge between a system and Prometheus. Many systems you want to monitor, such as the Linux kernel, MySQL, PostgreSQL, a load balancer or a network switch, have their own way of reporting statistics: /proc files, SQL status queries, SNMP or a JSON admin API. An exporter reads these statistics, converts them into Prometheus metrics with names, labels and types, and publishes them on an HTTP endpoint. Prometheus then scrapes this endpoint like any other target.
Exporters exist because you cannot add a client library to software you do not control. Your own applications usually expose metrics directly through a Prometheus or OpenTelemetry client library; exporters cover everything else.
How an exporter works
- Prometheus sends an HTTP GET request to the exporter, for example
http://db-host:9104/metrics. - The exporter queries the underlying system at that moment, for example by running
SHOW GLOBAL STATUSon MySQL. - It converts the results into the text-based exposition format and returns them.
- Prometheus stores the samples with the target labels
jobandinstance.
A response looks like this:
# HELP node_filesystem_avail_bytes Filesystem space available to non-root users in bytes.
# TYPE node_filesystem_avail_bytes gauge
node_filesystem_avail_bytes{device="/dev/sda1",mountpoint="/"} 4.2e+10
Most well-written exporters collect data synchronously during the scrape instead of caching it, so every value is as fresh as the scrape. Expensive checks can be cached or moved to separate collectors.
Because the exporter runs on demand, the scrape interval effectively decides how often the monitored system is queried. A database exporter scraped every 15 seconds by two redundant Prometheus servers runs its status queries eight times per minute. For most systems this is negligible, but for very large schemas or slow management APIs it is worth checking the exporter's own duration metric and disabling collectors you do not need. Most exporters let you switch individual collectors on or off with command-line flags.
Common exporters
| Exporter | Monitors | Typical metrics |
|---|---|---|
node_exporter | Linux and Unix hosts | CPU, memory, disk, filesystem, network |
blackbox_exporter | Endpoints from outside | HTTP, TCP, DNS and ICMP probe results and durations |
mysqld_exporter | MySQL and MariaDB | Connections, queries, replication lag, InnoDB stats |
postgres_exporter | PostgreSQL | Connections, transactions, locks, replication |
| JMX exporter | Java applications | JVM heap, GC, threads, MBeans |
kube-state-metrics | Kubernetes objects | Deployment, pod and node status |
Exporter metrics are only as useful as the context around them. Make sure each exporter is scraped with labels that identify the monitored system, not just the exporter process, for example the database cluster or the host role. Otherwise a sidecar exporter and a central probe can produce series that are hard to tell apart.
The Prometheus project maintains several exporters itself, the prometheus-community organization many more, and the Prometheus documentation lists a large number of third-party exporters.
Deployment patterns
- Per host:
node_exporterruns on every machine, in Kubernetes as a DaemonSet. - Sidecar: a database exporter runs next to the database in the same pod.
- Central probe: a single
blackbox_exporteror SNMP exporter queries many remote targets, which are passed as URL parameters. - Embedded: some software ships a built-in
/metricsendpoint, which removes the need for a separate exporter.
Writing your own exporter
If no exporter exists for a system, writing one is straightforward with the official client libraries for Go, Java, Python or Ruby. Follow the Prometheus guidelines:
- Use base units and suffixes:
_seconds,_bytes, and_totalfor counters. - Prefix metrics with the exporter or system name, for example
myapp_. - Expose raw counters, not pre-computed rates; Prometheus calculates rates itself.
- Keep label values bounded. Labels with user IDs or URLs create high cardinality.
- Expose an
up-style metric for the backend, so a failing connection is visible. - Check the default port allocation list on the Prometheus wiki to avoid port collisions.
Exporters and OpenTelemetry
In OpenTelemetry, the word "exporter" means something different: a component in an SDK or the OpenTelemetry Collector that sends data out to a backend, for example the OTLP exporter. The Prometheus-style role is filled by Collector receivers, such as the host metrics receiver or database receivers. The Collector's Prometheus receiver can also scrape existing Prometheus exporters, so they can be reused in an OpenTelemetry pipeline.
How Obseria helps
The Obseria Agent and any OpenTelemetry Collector can scrape your existing Prometheus exporters and send the metrics to Obseria, where they are linked to the hosts, databases and services they describe. Prebuilt views for database monitoring and metrics monitoring work with common exporters. Details are in the Prometheus integration.