A deployment goes out on Friday evening. By Saturday morning the site is slow, and nobody notices until a customer complains. Monitoring exists so that you find out first, ideally before users do. In most DevOps teams today, that monitoring is built on two open-source tools: Prometheus and Grafana.
The short answer: Prometheus collects and stores metrics, such as CPU use, request counts and error rates, by scraping them from your servers and apps every few seconds. Grafana turns those metrics into dashboards. Alertmanager, which ships with the Prometheus project, sends alerts when something crosses a threshold. Learn them after Linux and Docker. You can have a working dashboard on your laptop in an afternoon.
Monitoring is the month-four topic on our DevOps roadmap for freshers, and a part of DevOps training in Pune that interviewers often probe, because it shows whether you have thought about systems after they go live.
What each tool does
Prometheus
Prometheus is a time-series database with a built-in collector. It pulls metrics: every 15 seconds or so, it calls an HTTP endpoint, usually /metrics, on each target and stores the numbers with a timestamp. You query the data with PromQL, its own query language. Prometheus is a graduated CNCF project and the default choice for monitoring Kubernetes.
Exporters
Most software does not speak Prometheus out of the box, so exporters translate. node_exporter exposes Linux host metrics such as CPU, memory, disk and network. There are exporters for MySQL, PostgreSQL, Nginx, Redis and many more. Applications you write can expose their own metrics with a client library.
Grafana
Grafana does not store metrics itself. It connects to data sources such as Prometheus, Loki or CloudWatch, and draws dashboards from them. You can build panels by hand or import ready-made community dashboards, for example the popular Node Exporter Full dashboard.
Alertmanager
Prometheus evaluates alert rules, and Alertmanager handles what happens next: grouping related alerts, silencing them during maintenance and sending them to email, Slack, Microsoft Teams or an on-call tool.
Set it up on your laptop
The quickest way to learn is with Docker Compose. Save this as docker-compose.yml:
services:
prometheus:
image: prom/prometheus
ports: ["9090:9090"]
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
node-exporter:
image: prom/node-exporter
ports: ["9100:9100"]
grafana:
image: grafana/grafana
ports: ["3000:3000"]
And a minimal prometheus.yml that tells Prometheus what to scrape:
global:
scrape_interval: 15s
scrape_configs:
- job_name: node
static_configs:
- targets: ["node-exporter:9100"]
Run docker compose up -d. Open localhost:9090 and check Status, then Targets: the node job should show as UP. Then open Grafana on localhost:3000, add Prometheus as a data source using the URL http://prometheus:9090, and import a Node Exporter dashboard. You now have live CPU, memory and disk graphs.
Your first PromQL queries
PromQL looks strange at first, but a handful of patterns cover most daily use. Try these in the Prometheus query box:
# Is each target up? (1 = yes, 0 = no)
up
# CPU usage per machine, as a percentage
100 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
# Free disk space on the root filesystem, in GB
node_filesystem_avail_bytes{mountpoint="/"} / 1e9
The key idea is rate(). Many metrics are counters that only go up, such as total CPU seconds or total requests. rate(...[5m]) turns a counter into a per-second speed averaged over five minutes, which is what you actually want to graph.
What to monitor, and what to alert on
A common beginner mistake is alerting on everything. A useful starting point is the four golden signals from Google’s SRE book: latency (how long requests take), traffic (how many requests), errors (how many fail) and saturation (how full your resources are).
Then follow a simple rule: alert only when a human needs to act. A disk at 85% that grows slowly deserves a ticket, not a 3 a.m. call. A rising error rate on the checkout page deserves a page right away. Teams that ignore this end up with so many alerts that nobody reads them, which is worse than having none.
This thinking is a big part of the SRE role. Our comparison of DevOps vs SRE vs platform engineer explains how much monitoring work each job involves.
Where logs fit in
Metrics tell you that something is wrong. Logs usually tell you why. Prometheus does not store logs, so teams pair it with a log system: Grafana Loki is a natural fit because it shows logs in the same Grafana dashboards, while the ELK stack (Elasticsearch, Logstash and Kibana) is common in larger enterprises. As a beginner, get comfortable with metrics first, then add Loki.
A one-week practice plan
- Day 1: run the Docker Compose setup above and get the node target showing UP.
- Days 2 and 3: import a Node Exporter dashboard, then build your own panel from scratch with a PromQL query.
- Days 4 and 5: add an alert rule for high CPU or low disk, run Alertmanager and send the alert to email or Slack.
- Days 6 and 7: instrument a small app with a Prometheus client library, or monitor the containers from your Docker or Kubernetes practice project. Push the configs to GitHub.
A monitored app makes any portfolio project stronger. Add it to one of these DevOps projects for your resume and include a screenshot of the dashboard in the README.
Frequently asked questions
Do I need Kubernetes to learn Prometheus?
No. Start with Docker and a single Linux machine, as above. Prometheus is very common on Kubernetes, but the concepts are the same, and it is easier to learn them without a cluster in the way.
Is Grafana only for Prometheus?
No. Grafana works with many data sources, including Loki, Elasticsearch, MySQL, CloudWatch and Azure Monitor. Prometheus is simply the most common pairing.
Are Prometheus and Grafana free?
Both are open source and free to run yourself. Grafana Labs also sells a hosted cloud version, and some companies pay for commercial tools such as Datadog or New Relic instead.
What monitoring questions come up in DevOps interviews?
Expect questions like the difference between pull and push monitoring, what an exporter is, how rate() works, and how you would decide what to alert on. Being able to walk through a dashboard you built yourself is the strongest answer.





