Prometheus
Definition
Prometheus is an open-source systems monitoring and alerting toolkit that collects metrics from configured targets at given intervals, evaluates rule expressions, displays results, and triggers alerts when conditions are met.
Developed by SoundCloud and now hosted by the CNCF, Prometheus uses a pull-based model (it scrapes metrics from endpoints) and stores data in a time-series database on local storage.
Key Concepts
- Metric Types: Counter (monotonically increasing), Gauge (up/down), Histogram (distribution), Summary (percentiles)
- Labels: Key-value pairs that differentiate metric dimensions (e.g.,
job="nginx",instance="server1") - PromQL: Query language for selecting and aggregating time-series data
- Target: A monitored endpoint (e.g.,
/metricson a web server) - Exporter: A service that exposes metrics in Prometheus format (e.g., node_exporter, mysqld_exporter)
- Alertmanager: Handles alerts from Prometheus (notifications, silencing, inhibition)
- Service Discovery: Automatic target discovery (Kubernetes, DNS, file-based)
Architecture
Prometheus Server → Time-Series Database
↑ (scrapes)
Targets (exporters, app metrics)
↓
Alertmanager → Notifications (Slack, PagerDuty, email)
↓
Grafana → Dashboards and visualization
Common Exporters
| Exporter | Monitors |
|---|---|
| node_exporter | Linux host metrics (CPU, memory, disk, network) |
| mysqld_exporter | MySQL database metrics |
| postgres_exporter | PostgreSQL database metrics |
| redis_exporter | Redis metrics |
| blackbox_exporter | HTTP, DNS, TCP, ICMP probes |
| cadvisor | Container metrics |
Prometheus vs Other Monitoring
| Tool | Model | Best For |
|---|---|---|
| Prometheus | Pull-based, time-series | Cloud-native, Kubernetes |
| Grafana | Visualization (not storage) | Dashboards (often uses Prometheus) |
| Datadog | Pull/push, proprietary | Enterprise, multi-cloud |
| Zabbix | Push/pull, traditional | Traditional infrastructure |
| Nagios | Push-based, legacy | Traditional monitoring |
Related Terms
- Grafana — visualization tool commonly paired with Prometheus
- Alertmanager — Prometheus alerting component
- Exporters — services that expose metrics for Prometheus
- Kubernetes