Metrics Exporters in Prometheus

Introduction
Prometheus is a powerful monitoring system designed to collect metrics from various sources. However, not all applications and systems natively expose their metrics in a Prometheus-compatible format. This is where exporters come into play. Exporters act as bridges between Prometheus and external systems, exposing metrics in a format that Prometheus can scrape and store.
In this article, we will explore:
The available Prometheus exporters for different use cases.
How exporters work in the backend to collect and expose metrics.
1. What Are Exporters in Prometheus?
Exporters are services that collect metrics from applications, operating systems, databases, or hardware and expose them in Prometheus' exposition format.
Prometheus then scrapes these metrics from the exporters at predefined intervals and stores them in its Time Series Database (TSDB).
How Exporters Work in Prometheus?
Collect Raw Data – The exporter gathers raw metrics from an application, system, or service.
Format Data for Prometheus – Converts the collected data into Prometheus' exposition format.
Expose an HTTP Endpoint – Makes metrics available over an HTTP endpoint (
/metrics
).Prometheus Scrapes Data – Prometheus periodically queries the endpoint, processes the data, and stores it in TSDB.
Example Workflow
Exporter:
node_exporter
collects system-level metrics.Exposes metrics at:
http://localhost:9100/metrics
Prometheus scrapes it using the configuration:
scrape_configs: - job_name: "node" static_configs: - targets: ["localhost:9100"]
Metrics stored in TSDB and queried using PromQL
2. Commonly Used Prometheus Exporters
Prometheus supports a wide range of exporters, categorized based on the systems they monitor.
A. Node and System Exporters
Exporter | Description |
Node Exporter | Collects OS-level metrics such as CPU, memory, disk, and network statistics. |
cAdvisor | Monitors resource usage of Docker containers. |
Windows Exporter | Collects system metrics from Windows machines. |
SNMP Exporter | Collects metrics from network devices using SNMP. |
B. Database Exporters
Exporter | Description |
PostgreSQL Exporter | Collects PostgreSQL performance metrics. |
MySQL Exporter | Collects MySQL/MariaDB performance metrics. |
MongoDB Exporter | Gathers MongoDB database statistics. |
Redis Exporter | Provides Redis database performance metrics. |
C. Cloud and Kubernetes Exporters
Exporter | Description |
Kube State Metrics | Provides Kubernetes resource-level metrics (pods, nodes, deployments). |
AWS CloudWatch Exporter | Converts AWS CloudWatch metrics into Prometheus format. |
Google Cloud Monitoring Exporter | Fetches Google Cloud metrics for Prometheus. |
D. Application-Specific Exporters
Exporter | Description |
Nginx Exporter | Exposes Nginx performance metrics. |
Apache Exporter | Gathers Apache server statistics. |
Kafka Exporter | Provides Kafka broker and consumer metrics. |
JMX Exporter | Extracts metrics from Java applications via JMX. |
3. How Prometheus Exporters Work in the Backend
Exporters interact with Prometheus by collecting, processing, and exposing metrics. Here’s a step-by-step look at how they operate in the backend:
Step 1: Data Collection
The exporter queries the system, application, or database for real-time metrics.
It may use API calls, logs, command outputs, or direct system queries.
Example: Node Exporter reads from
/proc
and/sys
directories in Linux.
Step 2: Metric Formatting
Exporters structure the collected data in Prometheus' exposition format.
Example:
# HELP node_cpu_seconds_total Seconds the CPU spent in each mode. # TYPE node_cpu_seconds_total counter node_cpu_seconds_total{cpu="0", mode="user"} 1234.56
This format includes:
Metric name (
node_cpu_seconds_total
)Labels (metadata) (
cpu="0", mode="user"
)Metric type (
counter
)Value (
1234.56
)
Step 3: Exposing an HTTP Endpoint
Exporters expose an HTTP endpoint (
/metrics
) where Prometheus scrapes data.Example:
http://localhost:9100/metrics
(Node Exporter)http://localhost:9187/metrics
(PostgreSQL Exporter)
Step 4: Prometheus Scrapes the Data
Prometheus regularly fetches metrics by making HTTP GET requests.
Example:
curl http://localhost:9100/metrics
Scraped metrics are stored in Prometheus TSDB.
Step 5: Querying & Visualization
Metrics can be queried using PromQL.
Example:
rate(http_requests_total[5m])
Data is visualized using Grafana dashboards.
4. Configuring Prometheus to Scrape Exporters
To integrate an exporter with Prometheus, add a scrape job in prometheus.yml
.
Example: Configuring Node Exporter
scrape_configs:
- job_name: "node"
static_configs:
- targets: ["localhost:9100"]
Example: Configuring PostgreSQL Exporter
scrape_configs:
- job_name: "postgres"
static_configs:
- targets: ["localhost:9187"]
Restart Prometheus to apply changes:
systemctl restart prometheus
Conclusion
Prometheus exporters are essential for collecting metrics from various sources. Understanding how they work in the backend helps in: Configuring monitoring for different systems. Optimizing metric collection and storage Troubleshooting exporter-related issues
Exporters are the backbone of Prometheus-based monitoring, providing seamless integration with diverse platforms like operating systems, databases, cloud services, and applications.
Subscribe to my newsletter
Read articles from Saurabh Adhau directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Saurabh Adhau
Saurabh Adhau
As a DevOps Engineer, I thrive in the cloud and command a vast arsenal of tools and technologies: ☁️ AWS and Azure Cloud: Where the sky is the limit, I ensure applications soar. 🔨 DevOps Toolbelt: Git, GitHub, GitLab – I master them all for smooth development workflows. 🧱 Infrastructure as Code: Terraform and Ansible sculpt infrastructure like a masterpiece. 🐳 Containerization: With Docker, I package applications for effortless deployment. 🚀 Orchestration: Kubernetes conducts my application symphonies. 🌐 Web Servers: Nginx and Apache, my trusted gatekeepers of the web.