Dynamic Timeseries from Dashboard Variables
Video Lecture
Description
We create Dynamic Graphs from a query using our dashboard variables.
Dashboard JSON
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"id": 42,
"iteration": 1639994727656,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": 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": 5,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "right"
},
"tooltip": {
"mode": "single"
}
},
"repeat": "instance",
"repeatDirection": "v",
"targets": [
{
"exemplar": true,
"expr": "rate(node_network_receive_bytes_total{job=\"node\",instance=~\"$instance\"}[1m])",
"interval": "",
"legendFormat": "{{device}} in",
"refId": "A"
},
{
"exemplar": true,
"expr": "rate(node_network_transmit_bytes_total{job=\"node\",instance=~\"$instance\"}[1m])",
"hide": false,
"interval": "",
"legendFormat": "{{device}} out",
"refId": "B"
}
],
"title": "Network : $instance",
"type": "timeseries"
}
],
"refresh": false,
"schemaVersion": 32,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {
"selected": true,
"text": ["All"],
"value": ["$__all"]
},
"datasource": "Prometheus",
"definition": "label_values(node_uname_info{job=\"node\"},instance)",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "instance",
"options": [],
"query": {
"query": "label_values(node_uname_info{job=\"node\"},instance)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Dynamic Timeseries",
"uid": "DtcU5hTnk",
"version": 5
}