Chapter 87: Prometheus and Grafana Monitoring
87.11 Comparison, interview questions and revision
Comparison — Prometheus + Grafana vs CloudWatch
Use the card below (loads from your S3 cards bucket). Then read the short table.
| Approach | Best when | Weak when |
|---|---|---|
| Prometheus + Grafana | Kubernetes and custom app metrics, PromQL, portable dashboards | You must run and retain the stack; multi-account AWS needs extra design |
| CloudWatch | AWS-native metrics, logs and alarms with little ops | Custom high-cardinality app metrics and complex PromQL-style queries cost more effort |
| Both | Common in real companies: CloudWatch for AWS services, Prometheus for apps on EKS | Two systems need clear ownership so alerts do not double-page |
Interview questions
- What is Prometheus? — A pull-based metrics system with a TSDB and PromQL.
- Counter vs gauge? — Counters only increase (use rate); gauges go up and down.
- What is an exporter? — A process that exposes /metrics for something that does not natively speak Prometheus.
- ServiceMonitor? — Operator CR that tells Prometheus which Kubernetes Services to scrape.
- Recording vs alerting rules? — Recording precomputes series; alerting fires when an expression stays true for
for:. - What does Alertmanager do? — Groups, routes, silences and sends notifications.
- SLO vs raw threshold? — SLO ties alerts to user journeys and error budgets; raw CPU pages can be noisy.
Revision checklist
- [ ] I can explain why metrics catch saturation before customers leave.
- [ ] I can describe scrape → TSDB → PromQL.
- [ ] I can write a rate() and a simple error-ratio query.
- [ ] I can curl /metrics and read HELP/TYPE lines.
- [ ] I can apply a ServiceMonitor and fix label mismatches.
- [ ] I can install kube-prometheus-stack with Helm on kind.
- [ ] I keep webhook secrets out of Git.
Quick quiz
Q1. Name two pieces of kube-prometheus-stack.
Prometheus Operator/Prometheus, Grafana, Alertmanager, node exporters — any two.
Q2. Prometheus vs CloudWatch in one line?
Prometheus is portable PromQL metrics often on Kubernetes; CloudWatch is AWS-native metrics, logs and alarms.
Q3. What must never go into Git?
Slack webhooks, SMTP passwords, Grafana admin passwords and cloud access keys.
Ravindra Bagale's Tip
In interviews, say why then what then how, and finish with one PromQL line from this lab — for example rate(http_requests_total[5m]).
मुलाखतीत why नंतर what नंतर how सांगा, आणि या lab मधील एक PromQL सांगून संपवा — उदाहरण rate(http_requests_total[5m]).
इंटरव्यू में why फिर what फिर how कहें, और इस lab की एक PromQL बताकर खत्म करें — जैसे rate(http_requests_total[5m]).
In short
- Metrics show saturation and latency before the outage call.
- Prometheus scrapes, stores in TSDB and answers PromQL.
- Exporters and app /metrics feed the system; ServiceMonitor wires Kubernetes.
- Rules and Alertmanager turn queries into calm pages; Grafana shows the picture.
- SLOs and burn rates connect alerts to user happiness.
- Next teaching chapter: AWS EKS for DevOps (chapter 88).
Did you understand? Let us try it once more.