Repeating Timeseries using Dashboard Variables
Video Lecture
Description
We create dynamically repeating graphs from a query using a dashboard variable and the repeat option.
The queries I used in the Network visualization were,
rate(node_network_receive_bytes_total{job="node",instance=~"$instance"}[$__rate_interval])
rate(node_network_transmit_bytes_total{job="node",instance=~"$instance"}[$__rate_interval])
Dashboard Model JSON
Grafana v11.2.2
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 35,
"links": [],
"panels": [
{
"datasource": {
"default": false,
"type": "prometheus",
"uid": "ee0jwnzdenfgga"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"repeat": "instance",
"repeatDirection": "v",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "ee0jwnzdenfgga"
},
"editorMode": "code",
"expr": "rate(node_network_receive_bytes_total{job=\"node\",instance=~\"$instance\"}[$__rate_interval])",
"instant": false,
"legendFormat": "{{device}} in",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "ee0jwnzdenfgga"
},
"editorMode": "code",
"expr": "rate(node_network_transmit_bytes_total{job=\"node\",instance=~\"$instance\"}[$__rate_interval])",
"hide": false,
"instant": false,
"legendFormat": "{{device}} out",
"range": true,
"refId": "B"
}
],
"title": "Network : $instance",
"type": "timeseries"
}
],
"refresh": "5s",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": ["All"],
"value": ["$__all"]
},
"datasource": {
"type": "prometheus",
"uid": "ee0jwnzdenfgga"
},
"definition": "label_values({job=\"node\"},instance)",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "instance",
"options": [],
"query": {
"qryType": 1,
"query": "label_values({job=\"node\"},instance)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "Prometheus Node Exporters Network",
"uid": "ce38fxvy7s0e8d",
"version": 6,
"weekStart": ""
}