Data is useless if you can't understand it. Numbers in a spreadsheet don't tell a story. But a well-designed dashboard? That tells you everything at a glance.
That's Grafana. It takes the metrics from your systems — servers, applications, databases, IoT devices, whatever — and turns them into dashboards that actually make sense. It's the tool you didn't know you needed until you have it.
And here's the best part: it's free and open source. Run it yourself. Own your data. Visualize anything.
What Can Grafana Do?
Short answer: visualize time-series data. Long answer: pretty much anything involving metrics, logs, and traces.
- Infrastructure monitoring — CPU, memory, disk, network from all your servers
- Application metrics — Request rates, response times, error rates, custom app metrics
- Database queries — Visualize query performance, connections, cache hits
- IoT and sensors — Temperature, humidity, motion, anything with a reading
- Business metrics — Signups, revenue, user activity, whatever matters to you
- Logs — With Loki integration, search and visualize logs alongside metrics
- Distributed traces — With Tempo, see request flow through your system
Grafana connects to almost anything: Prometheus, InfluxDB, Elasticsearch, MySQL, PostgreSQL, Graphite, CloudWatch, Stackdriver, and dozens more.
Installing Grafana
Let's get Grafana running. I'll show a few options, starting with Docker because it's the easiest.
The Docker Way
docker run -d \
--name grafana \
-p 3000:3000 \
-v grafana_data:/var/lib/grafana \
grafana/grafana:latest
Wait a moment, then visit http://localhost:3000. Default login is admin / admin. You'll be prompted to change your password.
Installing on a Server
For a permanent installation on Debian/Ubuntu:
# Install dependencies
sudo apt install -y apt-transport-https software-properties-common
# Add Grafana repository
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
# Install Grafana
sudo apt update
sudo apt install grafana
# Start and enable
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
Grafana runs on port 3000 by default. Visit http://your-server:3000.
Your First Dashboard
Let's build something. I'll assume you're connecting to Prometheus — if you're using something else, the concepts are the same.
Step 1: Add a Data Source
- Click the gear icon (Configuration) in the sidebar
- Select "Data Sources"
- Click "Add data source"
- Select "Prometheus"
- Enter your Prometheus URL (e.g.,
http://localhost:9090for local) - Click "Save & Test"
Step 2: Create a Dashboard
- Click the "+" icon in the sidebar
- Select "Dashboard"
- Click "Add new panel"
In the panel editor:
- Enter a PromQL query, like
node_cpu_seconds_total{mode="idle"} - Choose "Time series" visualization
- Set a title like "CPU Usage"
Click "Apply" in the top right. You've got a graph.
Step 3: Add More Panels
Click "Add panel" again. Try these queries:
# Memory usage
node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes
# Disk usage
100 - (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"} * 100)
# Network traffic
rate(node_network_receive_bytes_total[5m])
rate(node_network_transmit_bytes_total[5m])
# Request rate (if you have a web server)
rate(http_requests_total[5m])
Arrange panels in a grid. Add titles. Configure units (bytes, seconds, percentages). This is your dashboard now.
Step 4: Save
Click the save icon (or press Ctrl+S). Give your dashboard a name. Now it's saved and you can access it from the sidebar.
Visualization Types
Grafana has more visualization options than you can shake a stick at. Here's when to use each:
- Time series — The default. Lines, areas, points over time.
- Stat — Single big number. "Total requests" or "Current temperature".
- Gauge — A gauge showing current value within a range.
- Bar chart — Compare values across categories.
- Heatmap — See density of values over time.
- Table — Tabular data. Good for sorted lists.
- Log panel — With Loki, show and search logs.
- Node graph — Visualize service connections (with Tempo).
- Geomap — Geographic visualizations.
- State timeline — State changes over time.
Don't overcomplicate. Usually, a time series and some stat panels tell the story best.
Variables: Dynamic Dashboards
One of Grafana's most powerful features is variables. A variable lets users select values (like a server name or service) and the whole dashboard updates.
To add a variable:
- Go to Dashboard Settings (the gear icon when viewing a dashboard)
- Click "Variables"
- Click "Add variable"
Configure it like this:
- Name:
server - Type: Query
- Data source: Prometheus
- Query:
label_names(node_cpu_seconds_total)
Now in your panel queries, use $server instead of hardcoding values:
node_cpu_seconds_total{instance="$server", mode="idle"}
Now users can select which server to view from a dropdown. One dashboard, multiple servers.
Alerts: Know Before Things Break
Grafana isn't just for looking at pretty graphs. It can alert you when things go wrong.
Setting Up Alerts
- Edit a panel
- Click the "Alert" tab
- Click "Create Alert"
- Configure conditions
Example alert rule:
- Evaluate: every 1 minute
- FOR: 5 minutes
- Conditions:
avg() OF query(A, 1m, now) IS ABOVE 90
This fires when the metric stays above 90 for 5 minutes.
Notification Channels
Where should alerts go? Configure notification channels in Configuration → Notification Channels:
- Email — Simple, but often ends up in spam
- Slack — Great for team visibility
- PagerDuty — For serious incident management
- OpsGenie — Another PagerDuty alternative
- Webhook — Call anything else
- Telegram — Direct bot messages
Pro tip: Don't alert on everything. Alert fatigue is real. Only alert on things that genuinely need attention.
The Grafana Ecosystem
Grafana isn't just Grafana anymore. It's a whole suite of observability tools:
Prometheus
The go-to metrics database. Scrapes targets, stores time series, powerful query language. If you're monitoring anything, start with Prometheus.
Loki
Log aggregation done right. Unlike Elasticsearch, Loki indexes just the labels, not the full log content. It's cheaper and faster for most use cases. Integrates perfectly with Grafana — see logs right next to your metrics.
Tempo
Distributed tracing. See how a request flows through your microservices. Click a trace in Grafana and see exactly where time was spent.
Mimir
Long-term storage for Prometheus. If you need to keep metrics for months or years, Mimir scales horizontally and handles Petabytes of data.
OnCall
Incident management. On-call schedules, escalation policies, automatic paging. Now Grafana does the whole observability stack.
Dashboards as Code
Clicking around in the UI is fine for learning, but for production, you want your dashboards in version control.
Export JSON
Every dashboard can be exported as JSON. Share it, commit it to Git, import it elsewhere.
Provisioning
Grafana can auto-provision dashboards from files. Put JSON files in /etc/grafana/provisioning/dashboards/ (or the docker equivalent):
# provisioning/dashboards/dashboards.yaml
apiVersion: 1
providers:
- name: 'My Dashboards'
folder: 'Ops'
type: file
options:
path: /etc/grafana/provisioning/dashboards
Now your dashboards are infrastructure as code. Review changes in pull requests. Roll back if something breaks.
Grafonnet
For ultimate control, use Grafonnet — a Jsonnet library for generating Grafana dashboards. Write code that produces dashboards. Templates, loops, abstractions. It's like Terraform for dashboards.
Real-World Dashboard Ideas
Need inspiration? Here are dashboards I build on every project:
System Overview
- CPU usage (per core)
- Memory usage
- Disk I/O and usage
- Network in/out
- Load average
Application Health
- Request rate (RPM/RPS)
- Response time (p50, p95, p99)
- Error rate
- Active connections
- Queue depth
Business Metrics
- User signups
- Active users
- Revenue (if applicable)
- API usage
- Feature adoption
Database
- Query rate
- Slow queries
- Connections
- Cache hit rate
- Replication lag
Styling and Theming
Grafana dashboards can be beautiful. Or they can be information-dense and ugly. Your choice.
Tips for better dashboards:
- Consistent colors — Use the same color for CPU across all dashboards
- Units matter — Don't show "1234567890 bytes", show "1.23 GB"
- Legend placement — Right or bottom, avoid covering data
- Time ranges — Default to reasonable ranges (1h, 6h, 24h)
- Dark mode — Easier on eyes in ops rooms
- Annotations — Mark deployments, incidents on the graph
Wrapping Up
Grafana transforms your understanding of systems. What was once abstract numbers becomes clear patterns. What was once "something seems slow" becomes "this endpoint is 200ms slower than yesterday."
Start simple. One server, basic metrics. Then add more. Add alerts. Add logs. Add traces. Before you know it, you've got full observability.
And it all runs on your infrastructure. Your data. Your dashboards.
That's the way it should be.
The revolution will not be proprietary.