Building Your First Dashboard
Now that you've learned how to connect data sources and write queries in Grafana, it's time to put everything together and build your first functional dashboard. In this lesson, you'll create a complete monitoring dashboard from scratch, combining multiple panels and layouts to display meaningful insights from your data.
Learning Goals
- Create and configure dashboard panels with different visualization types
- Organize panels using Grafana's layout system
- Apply dashboard settings and save your work
- Use time range controls effectively
- Share and export your dashboard
Creating Your First Dashboard
Start by navigating to the main Grafana interface and click the "+" icon in the sidebar, then select "Dashboard." You'll be presented with an empty dashboard canvas with a single "Add new panel" button.
Grafana automatically saves your work as you build, but remember to manually save with a descriptive name when you're finished to ensure your dashboard is properly stored.
Adding Your First Panel
Click "Add new panel" to open the panel editor. Here's where you'll configure your data source, query, and visualization settings.
Configuring Data Source and Query
Select your previously configured data source (like Prometheus, MySQL, or the TestData DB we set up earlier). For this example, we'll use the TestData DB:
SELECT
time as time,
value as value
FROM test_data
WHERE scenario = 'random_walk'
For Prometheus users, here's an equivalent example:
rate(http_requests_total[5m])
Choosing Visualization Types
Grafana offers various visualization types. Let's start with a simple Time series graph:
- In the panel editor, go to the "Visualization" tab
- Select "Time series" from the visualization dropdown
- Customize the appearance with colors, line styles, and axis labels
{
"type": "timeseries",
"title": "Request Rate",
"fieldConfig": {
"defaults": {
"color": {"mode": "palette-classic"},
"custom": {
"drawStyle": "line",
"lineWidth": 2
}
}
}
}
Building a Multi-Panel Dashboard
A good dashboard contains multiple panels that provide different perspectives on your data. Let's add several common panel types:
Stat Panel for Key Metrics
Add a new panel and choose "Stat" visualization:
SELECT
AVG(value) as average_value
FROM test_data
WHERE $__timeFilter(time)
Configure the stat panel to show:
- Value: Last (for current value)
- Stat: Average (for the time range)
- Color mode: Background (for visual impact)
Table Panel for Detailed Data
Tables are great for showing precise values and multiple dimensions:
SELECT
time,
value,
metric_name
FROM test_data
WHERE $__timeFilter(time)
ORDER BY time DESC
LIMIT 100
Gauge for Threshold Monitoring
Gauges help visualize values against predefined thresholds:
SELECT
MAX(value) as current_value
FROM test_data
WHERE $__timeFilter(time)
Configure threshold values (like 80 for warning, 90 for critical) in the panel settings.
Dashboard Layout and Organization
Using Grid Layout
Grafana uses a flexible grid system for panel arrangement:
- Drag panels to reposition them
- Resize panels by dragging their edges
- Use the grid guidelines to align panels neatly
Panels automatically snap to the grid, making it easy to create clean, organized layouts without precise manual positioning.
Row Organization
For complex dashboards, use rows to group related panels:
- Click "Add panel" → "Add row"
- Give the row a descriptive title (like "Application Metrics")
- Add panels within the row
- Collapse rows to save space when not needed
Dashboard Settings and Time Range
Configuring Dashboard Properties
Access dashboard settings by clicking the gear icon:
- General: Set dashboard title, description, and tags
- Variables: Configure dynamic filters (we'll cover this in detail later)
- Links: Add navigation links to related dashboards
- Versions: View and restore previous versions
Time Range Controls
The time picker in the top right controls the time range for all panels:
- Use relative time ranges (like "Last 6 hours")
- Set absolute time ranges for specific periods
- Use auto-refresh for real-time monitoring
From: now-1h
To: now
Refresh: 30s
Saving and Sharing
Saving Your Dashboard
Click the save icon (floppy disk) or press Ctrl+S:
- Enter a descriptive dashboard name
- Add tags for easier organization and search
- Choose a folder (default is "General")
- Click "Save"
Exporting and Importing
Export your dashboard as JSON for backup or sharing:
- Go to Dashboard Settings → JSON Model
- Copy the JSON or use the "Export" button
- Import via the "+" → "Import" option
Common Pitfalls
- Overcrowding: Avoid putting too many panels on one dashboard. Split into multiple focused dashboards instead.
- Missing context: Always include panel titles and units. Don't assume users know what metrics represent.
- Ignoring time zones: Ensure your dashboard time zone matches your data source and user expectations.
- Hard-coded values: Use dashboard variables instead of hard-coded filters for flexibility.
- Poor color choices: Use accessible color schemes and maintain consistency across panels.
Summary
You've successfully built your first Grafana dashboard! You learned how to create different types of panels, organize them effectively, configure dashboard settings, and save your work. Remember that good dashboards tell a story about your system's health and performance, so focus on clarity and relevance when choosing what to display.
Show quiz
-
What is the first step when creating a new dashboard in Grafana?
- A) Configure data sources
- B) Add a new panel
- C) Set time range
- D) Save the dashboard
-
Which visualization type is best for showing values against predefined thresholds?
- A) Time series
- B) Stat
- C) Gauge
- D) Table
-
How can you group related panels together in a dashboard?
- A) Using folders
- B) Creating rows
- C) Changing panel colors
- D) Adding tags
-
What keyboard shortcut saves your dashboard in Grafana?
- A) Ctrl+C
- B) Ctrl+V
- C) Ctrl+S
- D) Ctrl+D
-
Why should you avoid overcrowding your dashboard with too many panels?
- A) It slows down Grafana
- B) It makes the dashboard difficult to read and use
- C) It uses too much storage
- D) It requires more RAM
Answers:
- B) Add a new panel
- C) Gauge
- B) Creating rows
- C) Ctrl+S
- B) It makes the dashboard difficult to read and use