Prometheus
lastmod 2026-03-27created 2020-06-0937 edits
The Prometheus monitoring system and time series database.
Categories
- Prometheus:Pushgateway
- Prometheus:Alertmanager
- Prometheus:Exporters
- node-exporter - Exporter for machine metrics
- dcgm-exporter - NVIDIA GPU metrics exporter for Prometheus leveraging DCGM
- nvidia-smi-exporter (Ruby)
- nvidia-gpu-exporter (Go)
Features
Prometheus's main features are:
- a multi-dimensional data model with time series data identified by metric name and key/value pairs
- PromQL, a flexible query language to leverage this dimensionality
- no reliance on distributed storage; single server nodes are autonomous
- time series collection happens via a pull model over HTTP
- pushing time series is supported via an intermediary gateway
- targets are discovered via service discovery or static configuration
- multiple modes of graphing and dashboarding support
Components
The Prometheus ecosystem consists of multiple components, many of which are optional:
- the main Prometheus server which scrapes and stores time series data
- client libraries for instrumenting application code
- a push gateway for supporting short-lived jobs
- special-purpose exporters for services like HAProxy, StatsD, Graphite, etc.
- an alertmanager to handle alerts
- various support tools
Most Prometheus components are written in Go, making them easy to build and deploy as static binaries.
Architecture
This diagram illustrates the architecture of Prometheus and some of its ecosystem components:
Prometheus-architecture.svg.png
Prometheus vs InfluxDB
InfluxDB's data model
InfluxDB uses the concepts of series (Series) and measurement (Measurement). What does that mean? Let me explain it simply!
- Measurement (Measurement): This is what we want to measure. For example, things like "CPU usage" or "memory usage".
- Tag (Tag): Metadata that distinguishes data. Information like "server name" or "region" goes here.
- Field (Field): The actual measured value. Concrete numbers like "CPU usage 80%" or "memory usage 4GB" go here.
- Timestamp (Timestamp): Indicates when the data was recorded.
With this structure, you can store and search data really efficiently. For example, you can easily query "CPU usage over the last hour for all servers in Seoul".
Prometheus's data model
Prometheus takes a somewhat different approach. Here it uses the concepts of metric (Metric) and label (Label).
- Metric (Metric): What you want to measure. A concept similar to InfluxDB's measurement (Measurement).
- Label (Label): Metadata made of key-value pairs. Similar to InfluxDB's tags, but can be used more flexibly.
- Sample (Sample): The combination of an actual measured value and a timestamp.
This structure of Prometheus is especially strong at handling multi-dimensional data. For example, you can attach labels like "method", "status_code", and "endpoint" to a metric called "HTTP request count" and analyze the data in great detail.
The conclusion?
The difference in data models has a big impact on each database's performance and how it is used.
- InfluxDB is optimized for storing and searching time series data really fast.
- Prometheus, on the other hand, is more flexible at handling multi-dimensional data.
Because of these characteristics:
- InfluxDB is often used for IoT and sensor data processing,
- and Prometheus is widely used for managing complex systems, such as microservice monitoring.
Prometheus vs Grafana
Prometheus and Grafana are often used together as tools for monitoring and visualization, but they are designed for different purposes. The main differences are summarized below.
| Function/Feature | Prometheus | Grafana |
| Main role | Time series database and monitoring solution | Data visualization and dashboard management |
| Functions |
|
|
| Data storage | Stores data in its own time series database (TSDB) | Does not store data itself. Instead connects to various sources such as Prometheus, Elasticsearch, and MySQL |
| Data sources | Mainly collects metrics from applications using a pull model | Supports many sources such as Prometheus, InfluxDB, Elasticsearch, and MySQL |
| Query language | PromQL (Prometheus Query Language) | Supports query languages suited to each data source |
| Alerting system | Manages alerts through the built-in Alertmanager | Has its own alerting system, but mainly uses alerts provided by tools such as Prometheus |
| Scalability | Can run as a single node; scalability is supplemented through Pushgateway and similar tools | Various plugins and data sources can be added |
| Installation and configuration | Relatively simple, but needs Exporters for metric collection | Easy to use with an intuitive interface |
| Use cases |
|
|
| Integrated use | Mainly used as a data source for Grafana | Often used to visualize data collected by Prometheus in dashboards |
- Brief summary
- Prometheus collects and stores data, and generates alerts or performs analysis based on it.
- Grafana pulls data from multiple data sources such as Prometheus, visualizes it, and builds dashboards.
- Why use them together
- Prometheus excels at collecting and storing data, but is not well suited as a visualization tool. Grafana makes up for this by presenting the data intuitively, so the two tools complement each other.
- Real-world example
- Prometheus collects metrics such as CPU usage and memory usage.
- Grafana visualizes the data collected by Prometheus and displays it on a dashboard.
- When a system anomaly occurs, Prometheus Alertmanager triggers an alert.
How to run a demo
Run pushgateway:
First, write a prometheus.yml file:
global:
scrape_interval: 1s
scrape_configs:
- job_name: 'pushgateway'
static_configs:
- targets: ['192.168.100.153:9091']
- job_name: 'node'
static_configs:
- targets: ['192.168.100.153:9100']
- job_name: 'gpu'
static_configs:
- targets: ['192.168.100.161:9454']
Run node-exporter:
docker run --rm -it --net="host" --pid="host" -v "/:/host:ro,rslave" quay.io/prometheus/node-exporter:latest --path.rootfs=/host
If you need to monitor GPUs, run something like nvidia-smi-exporter.
Run Prometheus:
Open http://localhost:9090/ in a web browser.
To push sample data to pushgateway:
Troubleshooting
context deadline exceeded
This means Prometheus could not finish scraping metrics from the target within the set time (scrape_timeout). It can happen when the target takes a long time to respond, because of network problems or a firewall, or because the scrape timeout (scrape_timeout) in the Prometheus configuration is too short
Note that scrape_interval must not be smaller than scrape_timeout.
See also
- Monitoring
- Data visualization
- Time series database
- InfluxDB
- Grafana/Graphite
- ELK Stack (Elasticsearch, Logstash, Kibana, Beats)
- Grafana Mimir - Open-source ultra-fast time series DB
- Coroot - Monitoring platform for MSA
- Grafana Loki - Like Prometheus, but for logs.
- Thanos
- Upright - Synthetic monitoring engine using Playwright and Prometheus metrics
Favorite site
- Prometheus web site
- Who killed my lovely Prometheus container in the Kubernetes cluster!
- Monitoring with Prometheus — Part 1
- What is Prometheus?. Let's learn about the open-source monitoring tool Prometheus. | by ShinChul Bang | FINDA Tech Blog | Medium
- (Prometheus) Prometheus installation and concepts (points out "pull-based information collection" and "separate installation of each module" as drawbacks)
- (Monitoring) Prometheus complete summary
- 🎤 Installing and running prometheus
- Monitoring that completes stable operations: Prometheus and Grafana
with Grafana
- Building a monitoring system with grafana and prometheus - (Grafana + Prometheus)
- Applying Prometheus + Grafana - (Grafana + Prometheus)
- Cloud Native Computing Foundation
- Computer Sciences
- Coroot
- Database
- Dcgm-exporter
- DevOps
- Grafana
- Grafana Loki
- Grafana Mimir
- Graphite
- InfluxDB
- Kubeflow:Architecture
- Metrics Aggregations
- MLOps
- Monitoring
- Netdata
- Node-exporter
- Nvidia-smi-exporter
- OpenMetrics
- OpenTelemetry
- PagerDuty
- Postman
- Prometheus:Alertmanager
- Prometheus:client golang
- Prometheus:client python
- Prometheus:Exporters
- Prometheus:Pushgateway
- Prometheus:RemoteWriteAPI
- PromQL
- Simple Network Management Protocol
- Thanos
- Time series
- Time series database
- TimescaleDB
- Upright