Quick answer
Grafana is an open source tool that turns numbers from a database or a metrics service into dashboards you can read. It stores no data of its own; it asks a datasource for numbers and draws them as graphs and tables. This post installs Grafana 12.3.1, builds a shop orders dashboard, and fixes the one error that stops most beginners.
A shop owner in Karachi checks three numbers each morning: yesterday's sales, the top city, and any order that looks wrong. The numbers live in a spreadsheet, so the check means opening files and trusting memory. A dashboard fixes the routine, not the numbers: one page, the same three answers. Grafana is the usual pick because it is free, it runs anywhere, and it connects to almost anything that holds numbers. The catch is the first hour, when a blank panel and a short error make the tool look broken. This post walks through that hour with real orders.
What I would check before using it
My first check is whether I need a dashboard or just a better query. One person checking one number once a week needs a SQL query or a spreadsheet, not another server. When the same three numbers get checked every morning by several people, a dashboard starts to pay back. My judgement: install it when the question repeats daily, skip it while it keeps changing.
My second check is where the numbers already live. Grafana draws pictures; it collects and stores nothing. It needs a datasource, such as Prometheus for metrics or PostgreSQL for order rows. The Prometheus Tutorial: Metrics That Show What Your App Does post covers the metrics side, and the PostgreSQL Explained: The Reliable Database You Default To post covers the database side. With no datasource yet, the first job is getting the numbers somewhere Grafana can reach, not picking panel colours.
My third check is who keeps it running. Grafana is one small server, and the tarball install here took minutes, but dashboards go stale: queries break when a table changes, alerts fire at 3 AM, and someone has to own that. The OpenTelemetry Python: Trace a Checkout Flow End to End post shows the tracing side of the same picture, and the Docker Explained: Containers Without the Confusion post covers running services like this one. Agree on the owner before the first dashboard, not after the first outage.
My verdict, as judgement: use Grafana when the same numbers get checked daily and a datasource exists. The recommendation flips with no data source yet, because then it is a data pipeline wearing a dashboard costume, or if nobody keeps the dashboards honest, because a stale dashboard misleads faster than no dashboard.
Six orders, one dashboard, and the datasource Grafana could not find
The demo is a small shop orders dashboard: Grafana 12.3.1 from the official Linux tarball, with the built-in TestData datasource standing in for a real database.
Six orders, from 20 to 24 November 2026: Sana and Hamza in Karachi, Daniyal and Ayesha in Lahore, Mahnoor and Bilal in Islamabad.
time,city,total
2026-11-20T10:00:00Z,Karachi,9800
2026-11-21T11:00:00Z,Lahore,13400
2026-11-22T12:00:00Z,Islamabad,11200
2026-11-23T13:00:00Z,Karachi,6750
2026-11-24T14:00:00Z,Lahore,8900
2026-11-24T15:00:00Z,Islamabad,7200
First, the install and the health check:
$ ./grafana-12.3.1/bin/grafana-server --version
Version 12.3.1 (commit: 0d1a5b4420a5e4579b91c239ecb240ea2b247fba, branch: release-12.3.1)
$ curl -s http://localhost:3000/api/health
{
"database": "ok",
"version": "12.3.1",
"commit": "0d1a5b4420a5e4579b91c239ecb240ea2b247fba"
}
Then the datasource, created through the HTTP API:
$ curl -s -u admin:admin -H "Content-Type: application/json" \
-d '{"name":"Shop TestData","type":"testdata","access":"proxy"}' \
http://localhost:3000/api/datasources
{"datasource":{"id":1,"uid":"ag5bsxkdnxh4wa","name":"Shop TestData",
"type":"grafana-testdata-datasource","access":"proxy","isDefault":true},
"id":1,"message":"Datasource added","name":"Shop TestData"}
Note the UID in that reply: ag5bsxkdnxh4wa. Every panel refers to its datasource by UID, not by name, and that is where the demo goes wrong. A query before the datasource existed failed plainly:
$ curl -s -u admin:admin -H "Content-Type: application/json" \
-d '{"queries":[{"refId":"A","datasource":{"type":"testdata",
"uid":"no-such-datasource"},"scenarioId":"random_walk"}],
"from":"now-1h","to":"now"}' http://localhost:3000/api/ds/query
{"message":"Data source not found"}
Then the trap: a dashboard with a wrong UID in its panel saves without complaint:
$ curl -s -u admin:admin -H "Content-Type: application/json" \
-d '{"dashboard":{"title":"Shop Orders","uid":"shop-orders",
"panels":[{"id":1,"title":"Orders by city","type":"timeseries",
"datasource":{"type":"testdata","uid":"wrong-uid-123"},
"targets":[{"refId":"A","scenarioId":"csv_content"}]}]},
"overwrite":true}' http://localhost:3000/api/dashboards/db
{"id":1,"slug":"shop-orders","status":"success","uid":"shop-orders",
"url":"/d/shop-orders/shop-orders","version":1}
Status success, version 1. Grafana does not check the UID at save time; the panel only fails when it queries, with the same message. The fix is to list the datasources, copy the real UID, and update the panel:
$ curl -s -u admin:admin http://localhost:3000/api/datasources
[{"id":1,"uid":"ag5bsxkdnxh4wa","name":"Shop TestData",
"type":"grafana-testdata-datasource","isDefault":true}]
With the panel fixed to ag5bsxkdnxh4wa, the dashboard saved as version 3 and the query returned status 200 with all six orders:
$ curl -s -u admin:admin -H "Content-Type: application/json" \
-d '{"queries":[{"refId":"A","datasource":{"type":"testdata",
"uid":"ag5bsxkdnxh4wa"},"scenarioId":"csv_content",
"csvContent":"time,city,total\n2026-11-20T10:00:00Z,Karachi,9800\n
2026-11-21T11:00:00Z,Lahore,13400\n2026-11-22T12:00:00Z,Islamabad,11200\n
2026-11-23T13:00:00Z,Karachi,6750\n2026-11-24T14:00:00Z,Lahore,8900\n
2026-11-24T15:00:00Z,Islamabad,7200"}],
"from":"2026-11-19T00:00:00Z","to":"2026-11-25T00:00:00Z"}' \
http://localhost:3000/api/ds/query
{"results": {"A": {"status": 200, "frames": [{"data": {"values": [
[1795168800000, 1795258800000, 1795348800000, 1795438800000,
1795528800000, 1795532400000],
["Karachi", "Lahore", "Islamabad", "Karachi", "Lahore", "Islamabad"],
[9800, 13400, 11200, 6750, 8900, 7200]]}}]}}}
The totals check out: Karachi Rs 16,550, Lahore Rs 22,300, Islamabad Rs 18,400, a grand total of Rs 57,250. The dashboard is only as honest as the UID in its panel, and the save response will not say when that UID is wrong.
Common mistakes and how to fix them
First, querying with a wrong or missing datasource UID. The symptom is a panel that shows nothing and a query reply of {"message": "Data source not found"}. The fix is GET /api/datasources, copy the real UID, and paste it into the panel, never the name.
Second, trusting the save response. The symptom is a dashboard saved with status success while its panel shows the same error. The fix is to query the panel after saving, because Grafana checks the UID at query time, not at save time.
Third, filtering the datasource list by the wrong type. The symptom is a script that finds no datasource even though one exists, because the list API returns type "grafana-testdata-datasource", not "testdata". The fix is to match on the datasource name, or on the full type string the API returns.
Fourth, starting the server with a flag that does not exist. The symptom is the server exiting at once with "flag provided but not defined: -data". The fix is the environment variable instead: GF_PATHS_DATA=./data in front of the server command.
Frequently Asked Questions
Is Grafana a replacement for Prometheus? No, they do different jobs and usually work together. Prometheus collects and stores metrics, Grafana draws them.
Do I need Docker to run Grafana? No. This post ran the official Linux tarball directly, with a data directory set by an environment variable.
Why does my panel say Data source not found? The panel points at a UID that does not exist, or at a datasource that was deleted. List the datasources and copy the real UID into the panel.
Is Grafana free? The open source edition is free and covers dashboards, alerting, and most datasources. Grafana Cloud and Enterprise add hosting, extra features, and support, and those are paid.
What to remember
- Grafana draws dashboards; it stores no data, so every panel needs a datasource.
- Panels refer to datasources by UID, not by name.
- A dashboard can save with a wrong UID and only fail when the panel queries.
- "Data source not found" means the UID is wrong, so list datasources and copy the real one.
- Check the numbers behind the panel: six orders total Rs 57,250, with Lahore ahead at Rs 22,300.
Where this leaves you
Grafana earns its place the first morning the same three numbers appear on one page without opening a spreadsheet. The demo showed it: a tarball install, a health check that says ok, one API call to create a datasource, and a query that returned six real orders with totals that add up. The only hard part was a UID: a saved dashboard is not a working dashboard until its panels have actually queried. Build one panel against data you trust, and add a second only when the first has told the truth for a week.
Further reading
- Grafana installation docs
- Grafana dashboards docs
- Grafana datasources docs
- Prometheus Tutorial: Metrics That Show What Your App Does
- OpenTelemetry Python: Trace a Checkout Flow End to End
- NGINX Explained: The Server in Front of Your Server
Waqas Shahid is a software engineer from Karachi with more than 12 years of experience, including 6+ years in engineering leadership. He writes The Practical Developer.

Top comments (0)