Prometheus basics
Topic: Monitoring basics
Summary
Prometheus scrapes metrics from targets on an interval. Store time series; query with PromQL. Use for metrics and alerting in many environments.
Intent: How-to
Quick answer
- Install Prometheus. Add scrape configs for targets. Metrics exposed on HTTP. Scrape interval per job.
- Query with PromQL. Rate, sum, by. Use in Grafana or Alertmanager. Recording rules for heavy queries.
- Retention and storage. Alertmanager for routing. High availability with federation or Thanos.
Prerequisites
Steps
-
Install and scrape
Install Prometheus. Configure scrape_configs. Targets expose /metrics. Verify in UI.
-
Query and alert
PromQL in UI or Grafana. Define alert rules. Configure Alertmanager.
-
Retention and HA
Set retention. Use recording rules. Consider Thanos or federation for HA.
Summary
Install Prometheus. Scrape targets. Query with PromQL. Alert and retain.
Prerequisites
Steps
Step 1: Install and scrape
Install. Configure scrape. Verify.
Step 2: Query and alert
PromQL. Alert rules. Alertmanager.
Step 3: Retention and HA
Retention. Recording rules. HA if needed.
Verification
- Targets scraped. Queries return data. Alerts configured.
Troubleshooting
No scrape — Check target URL and network. High cardinality — Limit labels.