Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
- Connections → Data sources → Add → Prometheus, URL
http://127.0.0.1:9090→ Save & test. - Dashboards → New → Import, ID 1860 ("Node Exporter Full") → choose the Prometheus data source → Import.
- For your own: Dashboards → New → Add visualization, choose Prometheus, paste a query, set the unit, Save.
Step by step
- Connect the data source (UI as above — or as code, so it is the same on every Grafana):
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
uid: prom
url: http://127.0.0.1:9090
isDefault: truesystemctl restart grafana-server- Import a community dashboard for a quick start (Node Exporter Full = ID 1860). Look at it, then build your own small one — big imported dashboards are slow and hard to read.
- Your own panel — example "CPU used %" per server:
| Field | Value |
|---|---|
| Query | 100 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle", instance=~"$instance"}[$__rate_interval])) * 100 |
| Legend | {{instance}} |
| Unit | Percent (0-100) |
| Min / Max | 0 / 100 |
| Thresholds | 70 orange, 90 red |
$__rate_interval picks a safe rate() window for the zoom level.
- A server selector (variable) — Dashboard settings → Variables → New:
| Field | Value |
|---|---|
| Name | instance |
| Type | Query |
| Query | label_values(node_uname_info, instance) |
| Multi-value, Include All | on |
Use instance=~"$instance" in every query — one dashboard for all servers.
- Good dashboard rules:
- Top row: Stat panels for the big answers (up/down, error %, free disk).
- Below: time series for the details.
- The right unit on every panel (bytes, %, seconds) — never raw numbers.
- Few panels (about 6–12); one dashboard per question.
- Keep it in Git — Dashboard → Share/Export → Export as JSON (or the dashboard API), store the file, and load it with provisioning:
apiVersion: 1
providers:
- name: files
folder: Servers
type: file
options:
path: /var/lib/grafana/dashboardsCheck that it worked
Common problems
| Problem | Cause | Fix |
|---|---|---|
No data | Wrong data source, wrong label, or a time range with no data. | Run the query in Explore; check the labels in Prometheus. |
Imported dashboard says Datasource ${DS_PROMETHEUS} was not found | The import did not map the data source. | Import again and choose the data source; or set uid in provisioning. |
| Graph is spiky or empty when zoomed out | rate() window too small for the step. | Use $__rate_interval. |
| The dashboard is slow | Too many panels or heavy queries. | Fewer panels, recording rules in Prometheus, shorter default time range. |
| Changes lost after a rebuild | Dashboards were only in Grafana's database. | Provisioning from files in Git. |
| Everyone can edit production dashboards | Default roles. | Folder permissions: viewers for most people, editors for the team. |
Go further
- Command pages: grafana-cli, promtool.
- Next how-tos: Monitor a Linux server with Prometheus, Send alerts to Slack or email, Find slow requests in Nginx logs.
- Full guides: Grafana, Loki. At work: Grafana, Observability in DevOps.
- Practise: Lab: monitoring stack in one hour, Lab: from logs to an SLO.
1Why use a dashboard variable like $instance?
One dashboard works for every server; you pick the server(s) at the top.
2How do you make sure a dashboard is never lost?
Export it as JSON into Git and load it with provisioning.