Grafana Dashboards

Grafana Dashboards

Guides the AI in building production Grafana dashboards for Prometheus metrics, using RED and USE methods, layout hierarchy and JSON dashboard definitions.

Skill files1 file
SKILL.md377 lines
1
---
2
name: grafana-dashboards
3
description: Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.
4
---
5
6
# Grafana Dashboards
7
8
Create and manage production-ready Grafana dashboards for comprehensive system observability.
9
10
## Purpose
11
12
Design effective Grafana dashboards for monitoring applications, infrastructure, and business metrics.
13
14
## When to Use
15
16
- Visualize Prometheus metrics
17
- Create custom dashboards
18
- Implement SLO dashboards
19
- Monitor infrastructure
20
- Track business KPIs
21
22
## Dashboard Design Principles
23
24
### 1. Hierarchy of Information
25
26
```
27
┌─────────────────────────────────────┐
28
│ Critical Metrics (Big Numbers) │
29
├─────────────────────────────────────┤
30
│ Key Trends (Time Series) │
31
├─────────────────────────────────────┤
32
│ Detailed Metrics (Tables/Heatmaps) │
33
└─────────────────────────────────────┘
34
```
35
36
### 2. RED Method (Services)
37
38
- **Rate** - Requests per second
39
- **Errors** - Error rate
40
- **Duration** - Latency/response time
41
42
### 3. USE Method (Resources)
43
44
- **Utilization** - % time resource is busy
45
- **Saturation** - Queue length/wait time
46
- **Errors** - Error count
47
48
## Dashboard Structure
49
50
### API Monitoring Dashboard
51
52
```json
53
{
54
"dashboard": {
55
"title": "API Monitoring",
56
"tags": ["api", "production"],
57
"timezone": "browser",
58
"refresh": "30s",
59
"panels": [
60
{
61
"title": "Request Rate",
62
"type": "graph",
63
"targets": [
64
{
65
"expr": "sum(rate(http_requests_total[5m])) by (service)",
66
"legendFormat": "{{service}}"
67
}
68
],
69
"gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 }
70
},
71
{
72
"title": "Error Rate %",
73
"type": "graph",
74
"targets": [
75
{
76
"expr": "(sum(rate(http_requests_total{status=~\"5..\"}[5m])) / sum(rate(http_requests_total[5m]))) * 100",
77
"legendFormat": "Error Rate"
78
}
79
],
80
"alert": {
81
"conditions": [
82
{
83
"evaluator": { "params": [5], "type": "gt" },
84
"operator": { "type": "and" },
85
"query": { "params": ["A", "5m", "now"] },
86
"type": "query"
87
}
88
]
89
},
90
"gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 }
91
},
92
{
93
"title": "P95 Latency",
94
"type": "graph",
95
"targets": [
96
{
97
"expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, service))",
98
"legendFormat": "{{service}}"
99
}
100
],
101
"gridPos": { "x": 0, "y": 8, "w": 24, "h": 8 }
102
}
103
]
104
}
105
}
106
```
107
108
## Panel Types
109
110
### 1. Stat Panel (Single Value)
111
112
```json
113
{
114
"type": "stat",
115
"title": "Total Requests",
116
"targets": [
117
{
118
"expr": "sum(http_requests_total)"
119
}
120
],
121
"options": {
122
"reduceOptions": {
123
"values": false,
124
"calcs": ["lastNotNull"]
125
},
126
"orientation": "auto",
127
"textMode": "auto",
128
"colorMode": "value"
129
},
130
"fieldConfig": {
131
"defaults": {
132
"thresholds": {
133
"mode": "absolute",
134
"steps": [
135
{ "value": 0, "color": "green" },
136
{ "value": 80, "color": "yellow" },
137
{ "value": 90, "color": "red" }
138
]
139
}
140
}
141
}
142
}
143
```
144
145
### 2. Time Series Graph
146
147
```json
148
{
149
"type": "graph",
150
"title": "CPU Usage",
151
"targets": [
152
{
153
"expr": "100 - (avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)"
154
}
155
],
156
"yaxes": [
157
{ "format": "percent", "max": 100, "min": 0 },
158
{ "format": "short" }
159
]
160
}
161
```
162
163
### 3. Table Panel
164
165
```json
166
{
167
"type": "table",
168
"title": "Service Status",
169
"targets": [
170
{
171
"expr": "up",
172
"format": "table",
173
"instant": true
174
}
175
],
176
"transformations": [
177
{
178
"id": "organize",
179
"options": {
180
"excludeByName": { "Time": true },
181
"indexByName": {},
182
"renameByName": {
183
"instance": "Instance",
184
"job": "Service",
185
"Value": "Status"
186
}
187
}
188
}
189
]
190
}
191
```
192
193
### 4. Heatmap
194
195
```json
196
{
197
"type": "heatmap",
198
"title": "Latency Heatmap",
199
"targets": [
200
{
201
"expr": "sum(rate(http_request_duration_seconds_bucket[5m])) by (le)",
202
"format": "heatmap"
203
}
204
],
205
"dataFormat": "tsbuckets",
206
"yAxis": {
207
"format": "s"
208
}
209
}
210
```
211
212
## Variables
213
214
### Query Variables
215
216
```json
217
{
218
"templating": {
219
"list": [
220
{
221
"name": "namespace",
222
"type": "query",
223
"datasource": "Prometheus",
224
"query": "label_values(kube_pod_info, namespace)",
225
"refresh": 1,
226
"multi": false
227
},
228
{
229
"name": "service",
230
"type": "query",
231
"datasource": "Prometheus",
232
"query": "label_values(kube_service_info{namespace=\"$namespace\"}, service)",
233
"refresh": 1,
234
"multi": true
235
}
236
]
237
}
238
}
239
```
240
241
### Use Variables in Queries
242
243
```
244
sum(rate(http_requests_total{namespace="$namespace", service=~"$service"}[5m]))
245
```
246
247
## Alerts in Dashboards
248
249
```json
250
{
251
"alert": {
252
"name": "High Error Rate",
253
"conditions": [
254
{
255
"evaluator": {
256
"params": [5],
257
"type": "gt"
258
},
259
"operator": { "type": "and" },
260
"query": {
261
"params": ["A", "5m", "now"]
262
},
263
"reducer": { "type": "avg" },
264
"type": "query"
265
}
266
],
267
"executionErrorState": "alerting",
268
"for": "5m",
269
"frequency": "1m",
270
"message": "Error rate is above 5%",
271
"noDataState": "no_data",
272
"notifications": [{ "uid": "slack-channel" }]
273
}
274
}
275
```
276
277
## Dashboard Provisioning
278
279
**dashboards.yml:**
280
281
```yaml
282
apiVersion: 1
283
284
providers:
285
- name: "default"
286
orgId: 1
287
folder: "General"
288
type: file
289
disableDeletion: false
290
updateIntervalSeconds: 10
291
allowUiUpdates: true
292
options:
293
path: /etc/grafana/dashboards
294
```
295
296
## Common Dashboard Patterns
297
298
### Infrastructure Dashboard
299
300
**Key Panels:**
301
302
- CPU utilization per node
303
- Memory usage per node
304
- Disk I/O
305
- Network traffic
306
- Pod count by namespace
307
- Node status
308
309
### Database Dashboard
310
311
**Key Panels:**
312
313
- Queries per second
314
- Connection pool usage
315
- Query latency (P50, P95, P99)
316
- Active connections
317
- Database size
318
- Replication lag
319
- Slow queries
320
321
### Application Dashboard
322
323
**Key Panels:**
324
325
- Request rate
326
- Error rate
327
- Response time (percentiles)
328
- Active users/sessions
329
- Cache hit rate
330
- Queue length
331
332
## Best Practices
333
334
1. **Start with templates** (Grafana community dashboards)
335
2. **Use consistent naming** for panels and variables
336
3. **Group related metrics** in rows
337
4. **Set appropriate time ranges** (default: Last 6 hours)
338
5. **Use variables** for flexibility
339
6. **Add panel descriptions** for context
340
7. **Configure units** correctly
341
8. **Set meaningful thresholds** for colors
342
9. **Use consistent colors** across dashboards
343
10. **Test with different time ranges**
344
345
## Dashboard as Code
346
347
### Terraform Provisioning
348
349
```hcl
350
resource "grafana_dashboard" "api_monitoring" {
351
config_json = file("${path.module}/dashboards/api-monitoring.json")
352
folder = grafana_folder.monitoring.id
353
}
354
355
resource "grafana_folder" "monitoring" {
356
title = "Production Monitoring"
357
}
358
```
359
360
### Ansible Provisioning
361
362
```yaml
363
- name: Deploy Grafana dashboards
364
copy:
365
src: "{{ item }}"
366
dest: /etc/grafana/dashboards/
367
with_fileglob:
368
- "dashboards/*.json"
369
notify: restart grafana
370
```
371
372
373
## Related Skills
374
375
- `prometheus-configuration` - For metric collection
376
- `slo-implementation` - For SLO dashboards
377

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,378 prompts

More by @OpenSourceBuffGuy

See all
Candid olive athleisure woman walking with green smoothie prompt image

Candid olive athleisure woman walking with green smoothie

Draws a candid paparazzi-style shot of a woman in beige athleisure leaving an upscale market with a green smoothie, as a JSON spec with identity locked to a reference photo.

image-prompt, json-prompt, nano-banana, reference-image, face-reference, woman, fashion, street-photography, candid, negative-prompt, structured-output, photorealistic, natural-light, vertical-format, medium-shot, full-body, bokeh, muted-colors, luxury, fitness, food-photography, for-photographers, portrait, editorial

Man in white tee on coastal street prompt image

Man in white tee on coastal street

Draws a realistic street portrait of a young man in a white tee leaning on a pole along a coastal road, with exact camera settings and a cool overcast grade.

image-prompt, nano-banana, portrait, man, fashion, street-photography, photorealistic, full-body, natural-light, soft-lighting, muted-colors, cityscape, ocean, summer, symmetry, vertical-format, candid, long-form, for-photographers, medium-shot, editorial, fashion-shoot, bokeh

Raw sketchy ink portrait poster template prompt image

Raw sketchy ink portrait poster template

Fills in a template to draw a raw sketchy ink portrait poster of a person with an animal companion, broken contours, flat shadows and a two-tone palette.

image-prompt, gpt-image, template, placeholders, poster, portrait, ink-drawing, sketch, illustration, limited-palette, pet-portrait, animals, medium-shot, printmaking, vertical-format, flat-design, for-artists, for-designers, quick, vibrant-colors, negative-space

Reviews

Loading reviews…

Discussion

Loading comments…