Grafana
Fleetinggrafana
vizualization on top of prometheus
“export for sharing externally” won’t work with provisioning
grafana “export for sharing externally” won’t work with provisioning
When using it, it changes the datasources UID with the type/name and will supposedly find the approriate datasource once imported. Yet, this behavior appears to be triggered only when:
- either importing graphically
- or provisioning and then clicking on edit and save
Therefore, it appears to only follow a clickops way of thinking.
issues with alerting
I wanted to add alerts for a loki dashboard.
- the alerting does not work with an existing dashboard, I need to rewrite the query,
- the query needs to return a number, not logs, making annoying to get access in the future to the query when the alert is raised,
- I cannot save any alert using the graphical interface and an anonymous user (https://github.com/grafana/grafana/issues/83033)
how to export programmatically the dashboards
curl "${grafanaaddr}/api/search?query="|jq
[
{
"id": 1,
"uid": "cec998dhmtfy8e",
"orgId": 1,
"title": "nomad",
"uri": "db/nomad",
"url": "/grafana/dashboards/f/cec998dhmtfy8e/nomad",
"slug": "",
"type": "dash-folder",
"tags": [],
"isStarred": false,
"sortMeta": 0,
"isDeleted": false
},
{
"id": 2,
"uid": "nomadnodes",
"orgId": 1,
"title": "Nodes",
"uri": "db/nodes",
"url": "/grafana/d/nomadnodes/nodes",
"slug": "",
"type": "dash-db",
"tags": [],
"isStarred": false,
"folderId": 1,
"folderUid": "cec998dhmtfy8e",
"folderTitle": "nomad",
"folderUrl": "/grafana/dashboards/f/cec998dhmtfy8e/nomad",
"sortMeta": 0,
"isDeleted": false
}
]
curl "${grafanaaddr}/api/dashboards/uid/nomadnodes"|jq
{
"meta": {
"type": "db",
"canSave": true,
"canEdit": true,
"canAdmin": true,
"canStar": false,
"canDelete": true,
"slug": "nodes",
"url": "/grafana/d/nomadnodes/nodes",
"expires": "0001-01-01T00:00:00Z",
"created": "2025-02-06T15:04:57Z",
"updated": "2025-02-06T15:04:57Z",
"updatedBy": "Anonymous",
"createdBy": "Anonymous",
"version": 1,
"hasAcl": false,
"isFolder": false,
"folderId": 1,
"folderUid": "cec998dhmtfy8e",
"folderTitle": "nomad",
"folderUrl": "/grafana/dashboards/f/cec998dhmtfy8e/nomad",
"provisioned": true,
"provisionedExternalId": "nomad/nodes.json",
"annotationsPermissions": {
"dashboard": {
"canAdd": true,
"canEdit": true,
"canDelete": true
},
"organization": {
"canAdd": true,
"canEdit": true,
"canDelete": true
}
}
},
"dashboard": {
"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": 2,
"links": [],
"panels": [
{
"datasource": {
"type": "datasource",
"uid": "-- Mixed --"
},
"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": 16,
"w": 22,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "11.5.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"disableTextWrap": false,
"editorMode": "builder",
"expr": "sum by(host, disk) (nomad_client_host_disk_used_percent{node_status=\"ready\", disk!=\"/dev/vdb\"})",
"fullMetaSearch": false,
"includeNullMetadata": true,
"key": "Q-3c0e7e4f-2461-4ba5-9106-5a8bb9bd2632-0",
"legendFormat": "{{host}}-{{disk}}",
"range": true,
"refId": "diskusage",
"useBackend": false
}
],
"title": "Disk usage",
"type": "timeseries"
}
],
"preload": false,
"refresh": "",
"schemaVersion": 40,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "Nodes",
"uid": "nomadnodes",
"version": 1,
"weekStart": ""
}
}