Bar Gauge Panels
Introduction
Bar Gauge panels are one of Grafana's most effective visualization tools for displaying single-value metrics with thresholds. Unlike standard gauges that use a dial or meter, Bar Gauges represent values as colored bars, making them excellent for dashboards where you need to monitor multiple related metrics at a glance.
In this guide, you'll learn:
- What Bar Gauge panels are and when to use them
- How to create and configure Bar Gauge panels
- Different display modes and orientation options
- How to set up thresholds and color mapping
- Real-world applications and best practices
What is a Bar Gauge Panel?
A Bar Gauge panel is a visualization type in Grafana that displays single values as colored bars or circles. It's particularly useful for showing:
- Current values against thresholds
- Progress toward goals
- Health status of services or components
- Resource utilization metrics (CPU, memory, disk space)
The key advantage of Bar Gauge panels is their visual clarity and space efficiency - they allow you to display multiple metrics in a compact, easily scannable format.
Creating Your First Bar Gauge Panel
Let's walk through creating a basic Bar Gauge panel in Grafana:
- From your Grafana dashboard, click the "Add panel" button
- Select "Add a new panel"
- In the visualization options, select "Bar Gauge"
- Configure your data source and query to return a single value
Here's what a simple configuration might look like:
// Example query returning CPU usage for a server
SELECT
last("usage_idle")
FROM "cpu"
WHERE $timeFilter
GROUP BY time($__interval)
Display Modes
Bar Gauge panels offer multiple display modes to suit different visualization needs:
1. Basic (Default)
The basic mode displays values as horizontal or vertical bars, depending on your orientation setting.
2. Gradient
Gradient mode applies a color gradient across the bar based on your thresholds, creating a smoother visual transition between states.
3. LCD
LCD mode mimics a digital display, showing the value as segments similar to an LCD screen. This mode works well for numeric displays where you want a technical aesthetic.
4. Retro LCD
A variation of LCD mode with a more vintage appearance, featuring rounded segments.
To change the display mode:
- Go to the "Display" tab in the panel editor
- Find the "Display mode" option
- Select your preferred mode from the dropdown
Orientation Options
Bar Gauge panels can be displayed in different orientations:
- Horizontal (default): Bars extend from left to right
- Vertical: Bars extend from bottom to top
To change orientation:
- Go to the "Display" tab
- Find the "Orientation" option
- Select either "Horizontal" or "Vertical"
Value Display Options
You can customize how values are displayed within your Bar Gauge:
Text Size and Mode
Control the size of text and how it's displayed:
// Example panel JSON config showing text options
{
"options": {
"text": {
"titleSize": 16,
"valueSize": 32
}
}
}
Units and Decimals
Configure appropriate units and decimal precision:
- In the "Field" tab, find the "Standard options" section
- Set the "Unit" to an appropriate measurement (percentage, bytes, etc.)
- Adjust "Decimals" to control precision
Value Mapping
Map specific numeric values to text for better context:
- In the "Field" tab, find "Value mappings"
- Click "Add value mapping"
- Choose between "Value", "Range", or "Regex" mapping types
- Define your mappings (e.g., map 0 to "Offline" or 100 to "Full Capacity")
Thresholds and Color Mapping
One of the most powerful features of Bar Gauge panels is threshold-based coloring, which helps highlight values that need attention.
Setting Up Thresholds
- Go to the "Field" tab in panel edit mode
- Find "Thresholds" and click "Add threshold"
- Define your threshold values and corresponding colors
For example, a server health metric might use:
- 0-70: Green (healthy)
- 70-90: Yellow (warning)
- 90-100: Red (critical)
// Example threshold configuration
{
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "green", "value": null },
{ "color": "yellow", "value": 70 },
{ "color": "red", "value": 90 }
]
}
}
Color Mode Options
You can choose how colors are applied to your bar gauges:
- Value: Colors only the value text
- Background: Colors the entire background
- Bar: Colors only the bar (most common)
Multiple Stats in One Panel
Bar Gauge panels excel at displaying multiple related metrics in a single panel:
- Configure your query to return multiple series
- Each series will automatically be displayed as a separate bar
- Use the "Layout" options to control how multiple bars are arranged
For instance, to show CPU usage across multiple servers:
// Example query returning CPU usage for multiple servers
SELECT
last("usage_idle")
FROM "cpu"
WHERE $timeFilter
GROUP BY "host"
Practical Example: Server Resource Dashboard
Let's create a practical example of using Bar Gauge panels to monitor server resources:
// CPU Usage Query
SELECT 100 - mean("usage_idle") as "CPU Usage %"
FROM "cpu"
WHERE $timeFilter
GROUP BY time($__interval)
// Memory Usage Query
SELECT mean("used_percent") as "Memory Usage %"
FROM "mem"
WHERE $timeFilter
GROUP BY time($__interval)
// Disk Usage Query
SELECT mean("used_percent") as "Disk Usage %"
FROM "disk"
WHERE $timeFilter
GROUP BY time($__interval)
Configure these with appropriate thresholds:
- 0-60%: Green
- 60-85%: Yellow
- 85-100%: Red
This creates a compact dashboard showing all key server metrics at a glance, with color-coding to immediately highlight potential issues.
Advanced Configurations
Min and Max Values
Control the scale of your bar gauges by setting min and max values:
- In the "Field" tab under "Standard options"
- Set "Min" and "Max" values (e.g., 0 and 100 for percentage displays)
Calculation Options
For time series data, you can control how the single value is calculated:
- In the "Panel options" section
- Find "Calculation" and select from options like:
- Last value
- Mean
- Max/Min
- Total
Custom Tooltips
Enhance your Bar Gauge with informative tooltips:
// Example tooltip configuration
{
"options": {
"tooltip": {
"mode": "single",
"sort": "none"
}
}
}
Real-World Applications
Bar Gauge panels are versatile and can be used in many scenarios:
1. Infrastructure Monitoring
Monitor server farm health with bar gauges showing:
- CPU usage
- Memory utilization
- Network throughput
- Disk space
2. Application Performance
Track application metrics:
- Request latency
- Error rates
- Active users
- Queue depths
3. Business KPIs
Visualize business metrics:
- Sales targets (% achieved)
- Customer satisfaction scores
- Project completion percentages
- Inventory levels
4. IoT and Sensor Data
Display sensor readings:
- Temperature ranges
- Humidity levels
- Battery levels
- Signal strength
Best Practices
DO:
- Use consistent colors across your dashboard
- Group related metrics together
- Set appropriate min/max values for context
- Add clear titles and descriptions
- Use appropriate units
DON'T:
- Mix unrelated metrics in a single panel
- Overcrowd panels with too many bars
- Use Bar Gauges for time series trends (use Graph panels instead)
- Set arbitrary thresholds without business context
Summary
Bar Gauge panels are powerful tools in your Grafana visualization toolkit. They excel at displaying single-value metrics with threshold context in a compact, visually intuitive format. By properly configuring display modes, thresholds, and orientation, you can create information-dense dashboards that communicate status at a glance.
Remember these key points:
- Bar Gauges are ideal for single values, not trends over time
- Use thresholds to add context through color
- Multiple related metrics can be grouped in one panel
- Different display modes (Basic, Gradient, LCD) offer visual variety
- Proper unit selection enhances readability
Additional Resources
- Practice creating different types of Bar Gauge panels with various display modes
- Experiment with combining Bar Gauges with other panel types in a dashboard
- Try creating a resource monitoring dashboard for your own infrastructure
Exercise
Create a dashboard with the following Bar Gauge panels:
- A horizontal Bar Gauge showing CPU usage
- A vertical Bar Gauge showing memory usage
- An LCD-style gauge showing disk space
- A multi-stat Bar Gauge showing network metrics for different interfaces
Configure appropriate thresholds and experiment with different display options to see which works best for each metric type.
💡 Found a typo or mistake? Click "Edit this page" to suggest a correction. Your feedback is greatly appreciated!