Ravindra BagaleCourses & study guides मराठी

Chapter 87: Prometheus and Grafana Monitoring

DevOps

87.8 Grafana — datasource and a first dashboard

Story. After Prometheus was UP, Vikram in Mumbai opened Grafana from the same Helm release. The Prometheus datasource was already there. He imported a community Node Exporter dashboard ID from Grafana.com docs (not a random unknown file), then built one tiny row for shop-api request rate with the PromQL from lesson 3. Managers finally saw the same graph the on-call saw.

Add Prometheus datasource. Build or import a dashboard. Panels run PromQL and show graphs.
Add Prometheus datasource. Build or import a dashboard. Panels run PromQL and show graphs.

Why

Prometheus UI is for debugging queries. Grafana is how teams share live pictures in standups and war rooms.

What

  • Datasource — Connection from Grafana to Prometheus (URL inside the cluster DNS).
  • Dashboard — A page of panels.
  • Panel — One graph, stat or table backed by a query.
  • Variable — Dropdown filters such as namespace or job.
  • Explore — Ad-hoc PromQL without saving a dashboard.

How

  1. Port-forward Grafana; log in with the admin Secret from the Helm release (change the password).
  2. Confirm the Prometheus datasource points at the in-cluster Prometheus service.
  3. Create a dashboard → add a panel → paste PromQL → set legend.
  4. Save. Optionally import a known-good dashboard ID from Grafana's official dashboard library docs.

Example 1: Get Grafana admin password (lab)

kubectl -n monitoring get secret kube-prometheus-stack-grafana -o jsonpath='{.data.admin-password}' | base64 -d; echo

Output

(a random password — yours will differ)

What it shows: Initial admin password from the Secret. Change it. Do not paste real passwords into chat, tickets or Git.

Example 2: Panel query

sum by (job) (rate(http_requests_total{job="shop-api"}[5m]))

What it shows: Same PromQL as lesson 3, now drawn as a time series panel titled "shop-api RPS".

Ravindra Bagale's Tip

One golden-signals dashboard per product beats twenty random panels nobody owns.

Quick quiz

Q1. What is a Grafana datasource here?

The link from Grafana to your Prometheus HTTP API.

Q2. Where do you try PromQL quickly?

Grafana Explore or the Prometheus UI Graph tab.

Q3. Should admin passwords stay default?

No — change them and keep them out of Git.

Did you understand? Let us try it once more.