Skip to content

Grafana Dashboards: Building and Sharing Visualizations

DodaTech Updated 2026-06-23 6 min read

In this tutorial, you'll learn about Grafana Dashboards: Building and Sharing Visualizations. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

What You Will Learn

This tutorial teaches you how to create Grafana dashboards from scratch, configure Prometheus as a data source, design panels with PromQL queries, and share dashboards with your team.

Why It Matters

Raw metrics are hard to read. Grafana turns them into visual stories that help you spot trends, debug incidents, and communicate system health to stakeholders in seconds.

Real-World Use

The DodaTech operations team uses a single Grafana dashboard to monitor all production services. When an engineer joins the on-call rotation, the first thing they do is open the master dashboard to see service health at a glance.

Grafana is the leading open-source analytics and visualization platform. It connects to dozens of data sources including Prometheus, Loki, Graphite, and InfluxDB. Dashboards are composed of panels that display time-series data as graphs, tables, gauges, and heatmaps.


Prerequisites


Step-by-Step Tutorial

Step 1: Install Grafana

# Using Docker
docker run -d --name grafana -p 3000:3000 grafana/grafana:11.1.0

# Using APT on Ubuntu
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
sudo apt-get update
sudo apt-get install grafana
sudo systemctl start <a href="/devops/prometheus-grafana/">Grafana</a>-server

Expected output: Grafana starts and listens on port 3000.

Step 2: Log In and Add a Data Source

Navigate to http://localhost:3000. The default credentials are admin/admin. Grafana will prompt you to change the password on first login.

  1. Click the gear icon (Configuration) on the left sidebar
  2. Select Data Sources
  3. Click Add data source
  4. Choose Prometheus
  5. Set the URL to http://host.docker.internal:9090 (Docker) or http://localhost:9090 (binary)
  6. Click Save & Test

Expected output: A green banner says "Data source is working."

Step 3: Create Your First Dashboard

  1. Click the plus icon on the sidebar and select Dashboard
  2. Click Add visualization
  3. Select your Prometheus data source
  4. Enter this query in the PromQL field:
rate(prometheus_http_requests_total[5m])
  1. In the panel options on the right, set:
    • Title: HTTP Request Rate
    • Unit: cps (counts per second)
    • Type: Time series

Step 4: Add Multiple Panels

Click Add > New panel at the top. Add a second panel with this query:

node_memory_MemAvailable_bytes

Set the unit to bytes (SI) and title to Available Memory.

Step 5: Create a Stat Panel for Quick Health

Add a third panel and change the visualization type to Stat:

avg(node_load1)

Stat panels show a single value that updates in real time -- perfect for at-a-glance health indicators.

Step 6: Use Template Variables

Template variables make dashboards reusable across environments.

  1. Click the gear icon (Dashboard Settings)
  2. Go to Variables > Add variable
  3. Name: instance
  4. Type: Query
  5. Data source: Prometheus
  6. Query: label_values(node_load1, instance)
  7. Click Update

Now use $instance in your panel queries:

node_memory_MemAvailable_bytes{instance="$instance"}

This lets you switch between servers with a dropdown.

Step 7: Set Up Dashboard Annotations

Annotations mark events on time-series graphs.

  1. Go to Dashboard Settings > Annotations > Add annotation
  2. Name: Deploy Events
  3. Data source: Prometheus
  4. Query: deploy_timestamp > 0

Now every deploy event shows as a vertical line across all panels.

Step 8: Share the Dashboard

  1. Click the Share icon at the top of the dashboard
  2. Choose the Link tab to copy a direct URL
  3. Choose the Export tab to download a JSON model
  4. Choose the Embed tab to get an iframe snippet for embedding

For team sharing, save the dashboard JSON in your Git repository and use Grafana's provisioning feature.


Learning Path

flowchart LR
    A[Install Grafana] --> B[Add Data Source]
    B --> C[Create Panels]
    C --> D[Add Variables]
    D --> E[Set Annotations]
    E --> F[Share Dashboard]
    C -.-> G[Time Series]
    C -.-> H[Stat]
    C -.-> I[Table]
    style A fill:#4a90d9,color:#fff
    style F fill:#e67e22,color:#fff

Common Errors

  1. Data source says HTTP error 400 -- The URL is wrong or Grafana cannot reach Prometheus. If using Docker, use host.docker.internal instead of localhost.

  2. Panel shows "No data" -- The PromQL query returns no results. Verify the metric exists in Prometheus and check label filters.

  3. Template variable dropdown is empty -- The query in the variable definition returned no labels. Ensure the metric exists and has the expected label name.

  4. Dashboard loads slowly -- Too many panels querying wide time ranges. Reduce the time range, use recording rules, or add panel-level caching.

  5. Embedded dashboard does not render -- Anonymous access must be enabled in <a href="/devops/prometheus-grafana/">Grafana</a>.ini under [auth.anonymous].

  6. Annotation lines do not appear -- The annotation query must return a numeric value at the event timestamp. Verify the metric is present.

  7. Changes are lost after page refresh -- You must save the dashboard (Ctrl+S or the Save icon) before refreshing.


Practice Questions

  1. What is the default port for Grafana? Answer: 3000.

  2. How do you make a dashboard reusable across different environments? Answer: Use template variables that allow selecting server instance, environment, or region from a dropdown.

  3. What is the difference between a Time Series panel and a Stat panel? Answer: Time Series shows data over time as a line graph; Stat shows a single aggregated value.

  4. How can you share a dashboard without giving access to the Grafana server? Answer: Export the dashboard as JSON and import it into another Grafana instance, or use provisioning files.

  5. What is the purpose of an annotation in Grafana? Answer: To mark events (deploys, config changes, incidents) as vertical lines on graphs for correlation.


Challenge

Build a full-screen NOC dashboard with four rows: the first row shows four Stat panels for overall system health (CPU, memory, disk, load), the second row shows a time-series graph of HTTP traffic broken down by status code, the third row shows a table of the top 10 instances by error rate, and the fourth row shows a heatmap of request latency. Use template variables for instance selection and add deploy annotations. Export the final JSON and verify it imports cleanly into a fresh Grafana instance.


FAQ

Can Grafana send alerts without Grafana Alerting?

Grafana has a built-in alerting engine that works with any data source. You do not need a separate Alertmanager, but you can still use Prometheus Alertmanager alongside Grafana alerts.

How often do panels refresh?

The default refresh rate is every 10 seconds for active dashboards. You can set a custom refresh interval per dashboard or set it to off for static views.

Does Grafana support multi-tenancy?

Yes, through Organizations and Folders. Each organization has its own data sources, dashboards, and users with role-based access control.

Can I use Grafana with non-Prometheus sources?

Yes, Grafana supports over 50 data sources including Loki, Elasticsearch, InfluxDB, Graphite, CloudWatch, Azure Monitor, and Google Cloud Monitoring.

How do I make a dashboard public?

Enable anonymous authentication in Grafana.ini, grant anonymous users Viewer role, and share the dashboard URL or embed it.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro