Grafana Dashboards: Visualize Your Infrastructure
Learn how to install Grafana, connect data sources like Prometheus, and build beautiful monitoring dashboards for your servers and services.
Grafana Dashboards: Visualize Your Infrastructure
Grafana turns your metrics into actionable dashboards. This guide covers installation, connecting Prometheus as a data source, and building your first dashboard.
Prerequisites
- A Linux server
- Prometheus already collecting metrics (or use Grafana's test data)
Step 1: Install Grafana
sudo apt install -y software-properties-common
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt update
sudo apt install grafanasudo systemctl enable grafana-server
sudo systemctl start grafana-serverAccess Grafana at http://your-server:3000. Default login: admin / admin.
Step 2: Add Prometheus Data Source
- Go to Configuration > Data Sources > Add data source
- Select Prometheus
- URL:
http://localhost:9090(or your Prometheus address) - Click Save & Test
Step 3: Create Your First Dashboard
- Click + > New Dashboard > Add visualization
- Select your Prometheus data source
- Enter a PromQL query:
# CPU usage percentage
100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)- Set visualization type to Time series
- Add a title: "CPU Usage %"
Step 4: Build a Server Overview Dashboard
Add these panels:
Memory Usage:
(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100Disk Usage:
100 - ((node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) * 100)Network Traffic:
rate(node_network_receive_bytes_total{device="eth0"}[5m]) * 8Uptime:
(time() - node_boot_time_seconds) / 86400Step 5: Add Alerts
- Open any panel > Alert tab
- Set conditions (e.g., CPU > 90% for 5 minutes)
- Configure notification channel (email, Slack, PagerDuty)
- Save the dashboard
Step 6: Import Community Dashboards
Instead of building from scratch, import pre-built dashboards:
- Go to + > Import
- Enter a dashboard ID from grafana.com/grafana/dashboards
- Popular IDs:
Tips
- Use variables to make dashboards dynamic (e.g., dropdown for server selection)
- Set auto-refresh interval (top right)
- Use annotations to mark deployments on graphs
- Organize panels into rows for clean layouts
Conclusion
Grafana is the standard for infrastructure visualization. Start with the pre-built Node Exporter dashboard and customize from there. The key is making your dashboards actionable — every panel should answer a specific question about your infrastructure.