Introduction
Grafana is a powerful open-source visualization platform for monitoring data. It connects to various data sources (Prometheus, MySQL, PostgreSQL, Elasticsearch) and creates beautiful, interactive dashboards.
Installation
sudo apt install -y apt-transport-https software-properties-common
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt update
sudo apt install -y grafana
sudo systemctl enable --now grafana-serverAccess and Initial Setup
Access Grafana at http://your-ip:3000. Default login is admin/admin. Change the password immediately.
Adding Data Sources
- Navigate to Connections → Data Sources
- Choose your source type (Prometheus, MySQL, etc.)
- Enter the connection details and click Save & Test
Creating Dashboards
- Click Dashboards → New Dashboard
- Add a panel and select your data source
- Write a query or use the visual query builder
- Customize the visualization type (graph, gauge, stat, table)
Popular Pre-built Dashboards
- Node Exporter Full (ID: 1860) — comprehensive server monitoring
- MySQL Overview (ID: 7362) — database metrics
- Nginx (ID: 12708) — web server stats
Import via Dashboards → Import → Enter ID.