📈 Setup Grafana — Self-Hosted Monitoring Dashboards
Deploy Grafana on Ubuntu to visualize metrics, logs, and traces from any data source — the standard dashboard platform for Prometheus, Loki, and the entire observability stack.
📦 Resources & Setup Scripts
Grab the automated bash script from GitHub to follow along with the video.
Quick Install:
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/monitoring/grafana/grafana-ubuntu.sh
chmod +x grafana-ubuntu.sh
sudo bash grafana-ubuntu.sh
Tutorial Steps
1 Download the Script
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/monitoring/grafana/grafana-ubuntu.sh
2 Make it Executable
chmod +x grafana-ubuntu.sh
3 Run the Installer
The script installs Docker if needed, then deploys Grafana with persistent storage for dashboards and data source configurations.
sudo bash grafana-ubuntu.sh
4 Access the Web UI
Open your browser and navigate to:
http://<your-server-ip>:3000
5 Add a Data Source
Go to Connections → Data Sources → Add your first data source (Prometheus, Loki, InfluxDB, or others) to start building dashboards.
Ports Used
| Port | Purpose |
|---|---|
| 3000 | Grafana Web UI |
Overview
Grafana is the world's most popular open-source monitoring visualization platform. It connects to over 100 data sources — Prometheus, Loki, InfluxDB, MySQL, PostgreSQL, Elasticsearch, and many more — and lets you build beautiful, interactive dashboards without writing code. From server metrics to business KPIs, Grafana is the visualization layer of nearly every modern self-hosted monitoring stack.
Why Use It
Grafana transforms raw metric numbers into actionable visual dashboards. Instead of SSH-ing into servers to check CPU usage, you get a live panel showing the last 7 days of metrics for all your servers on one screen. The 5,000+ community dashboards mean you can import a production-grade dashboard for Node Exporter or Kubernetes in 30 seconds.
When You Need It
Who Should Use It
Real Use Cases
Main Features
How to Use After Installation
Security Best Practices
Ports and Firewall Notes
Grafana listens on port 3000. Open this port to your local network for team access. For external access, use Nginx Proxy Manager with SSL. Data source ports (Prometheus 9090, Loki 3100) should remain internal — Grafana queries them from within the Docker network.
Backup and Maintenance
Common Mistakes
Troubleshooting
Alternatives
Netdata (auto-discovery, no config, simpler), Uptime Kuma (uptime focus, not metrics), Kibana (Elasticsearch-only), Datadog (managed, expensive). Grafana is the universal standard — use it whenever you have a data source and want a visualization layer.
When Not to Use It
Grafana is a visualization layer — it needs a data source. Without Prometheus or another metrics backend, Grafana has nothing to show. If you want zero-configuration server monitoring with auto-discovery, start with Netdata instead and add Grafana later when you need custom dashboards.
PrismaTechWork Professional Help
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Frequently Asked Questions
What is the difference between Grafana and Prometheus?
Prometheus collects and stores metrics (the data layer). Grafana visualizes them (the presentation layer). Prometheus answers 'what happened?' with raw numbers. Grafana answers 'show me a graph of what happened.' They are always deployed together — neither is complete without the other.
Is Grafana free?
Yes, Grafana Open Source is completely free and Apache-licensed. Grafana Cloud offers a managed hosted version with a generous free tier. Grafana Enterprise adds SSO, audit logging, and report generation for a fee. For self-hosted use, the free OSS version has everything you need.
How do I import a community dashboard?
Go to Dashboards → Import in Grafana, enter the dashboard ID from grafana.com/grafana/dashboards (e.g. 1860 for Node Exporter Full), select your Prometheus data source, and click Import. You get a professional dashboard in under a minute.
Can Grafana connect to a database like MySQL or PostgreSQL?
Yes. Add MySQL or PostgreSQL as a data source in Grafana. You can then write SQL queries in panel editors to visualize any data stored in your database — user counts, order volumes, error rates, or any other business metric.
Can I set up alerts in Grafana without Prometheus?
Yes. Grafana Alerting works with any data source that supports time-series queries — Loki, InfluxDB, MySQL, Elasticsearch, and others. You define an alert rule pointing at a specific panel query, set a condition, and configure a notification channel.
How do I make dashboards accessible to my team without giving admin access?
Create user accounts with Viewer or Editor roles in Grafana. Viewers can see all dashboards but not edit them. Editors can create and modify dashboards. Admins can manage users and data sources. For larger organizations, use LDAP or OAuth to sync team permissions automatically.
What are Grafana variables and how do they work?
Variables are dynamic filters on dashboards — for example, a `$host` variable that shows a dropdown of all monitored servers. Every panel uses `$host` in its query, so selecting a different server from the dropdown instantly updates all panels. This makes one dashboard reusable across all your servers.
How do I update Grafana?
Run `docker compose pull && docker compose up -d`. Grafana's database (dashboards, users, data sources) is stored in a persistent volume and is not affected by image updates. For major version upgrades (e.g. 9.x to 10.x), read the migration guide — some plugin APIs changed.
