Files
homelab-infra/apps/dawarich/grafana/dashboard-dawarich.json
T

623 lines
16 KiB
JSON

{
"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": false,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"id": 10,
"type": "stat",
"title": "Points Last 30 Days",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 4,
"w": 6,
"x": 0,
"y": 0
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n now() AS \"time\",\n count(*)::double precision AS points\nFROM points\nWHERE timestamp >= extract(epoch from now() - interval '30 days')::integer\n AND timestamp <= extract(epoch from now())::integer\n AND lonlat IS NOT NULL;"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "points",
"values": false
},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "13.0.2"
},
{
"id": 11,
"type": "stat",
"title": "Kilometers Last 30 Days",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 4,
"w": 6,
"x": 6,
"y": 0
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n now() AS \"time\",\n round(coalesce(sum(distance), 0)::numeric / 1000.0, 2)::double precision AS km\nFROM tracks\nWHERE start_at >= now() - interval '30 days';"
}
],
"fieldConfig": {
"defaults": {
"unit": "km",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "km",
"values": false
},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "13.0.2"
},
{
"id": 12,
"type": "stat",
"title": "Tracks Last 30 Days",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 4,
"w": 6,
"x": 12,
"y": 0
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n now() AS \"time\",\n count(*)::double precision AS tracks\nFROM tracks\nWHERE start_at >= now() - interval '30 days';"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "tracks",
"values": false
},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "13.0.2"
},
{
"id": 13,
"type": "stat",
"title": "Anomalies Last 30 Days",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 4,
"w": 6,
"x": 18,
"y": 0
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n now() AS \"time\",\n count(*)::double precision AS anomalies\nFROM points\nWHERE timestamp >= extract(epoch from now() - interval '30 days')::integer\n AND timestamp <= extract(epoch from now())::integer\n AND anomaly IS TRUE;"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 1
}
]
}
},
"overrides": []
},
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "anomalies",
"values": false
},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "13.0.2"
},
{
"id": 1,
"type": "geomap",
"title": "Location Points",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 12,
"w": 14,
"x": 0,
"y": 4
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\n to_timestamp(timestamp) AS \"time\",\n ST_Y(lonlat::geometry)::double precision AS lat,\n ST_X(lonlat::geometry)::double precision AS lon,\n accuracy::double precision AS accuracy,\n coalesce(tracker_id, 'unknown') AS tracker\nFROM points\nWHERE timestamp >= extract(epoch from now() - interval '30 days')::integer\n AND timestamp <= extract(epoch from now())::integer\n AND lonlat IS NOT NULL\nORDER BY timestamp DESC\nLIMIT 5000;"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"basemap": {
"config": {},
"name": "Layer 0",
"type": "default"
},
"controls": {
"mouseWheelZoom": true,
"showAttribution": true,
"showDebug": false,
"showMeasure": false,
"showScale": true,
"showZoom": true
},
"layers": [
{
"config": {
"showLegend": false,
"style": {
"color": {
"fixed": "green"
},
"opacity": 0.7,
"size": {
"fixed": 5,
"max": 15,
"min": 2
},
"symbol": {
"fixed": "img/icons/marker/circle.svg",
"mode": "fixed"
}
}
},
"location": {
"latitude": "lat",
"longitude": "lon",
"mode": "coords"
},
"name": "Points",
"tooltip": true,
"type": "markers"
}
],
"tooltip": {
"mode": "details"
},
"view": {
"allLayers": true,
"id": "fit",
"lat": 52.0,
"lon": 7.5,
"zoom": 8
}
},
"pluginVersion": "13.0.2"
},
{
"id": 2,
"type": "timeseries",
"title": "Kilometers per Day",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 6,
"w": 10,
"x": 14,
"y": 4
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "WITH days AS (\n SELECT generate_series(\n date_trunc('day', now() - interval '30 days'),\n date_trunc('day', now()),\n interval '1 day'\n ) AS day\n)\nSELECT\n days.day AS \"time\",\n round(coalesce(sum(tracks.distance), 0)::numeric / 1000.0, 2)::double precision AS km\nFROM days\nLEFT JOIN tracks\n ON tracks.start_at >= days.day\n AND tracks.start_at < days.day + interval '1 day'\nGROUP BY days.day\nORDER BY days.day;"
}
],
"fieldConfig": {
"defaults": {
"unit": "km",
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "bars",
"fillOpacity": 70,
"lineWidth": 1,
"showPoints": "never",
"axisPlacement": "auto",
"barAlignment": 0
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"calcs": [
"sum"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "13.0.2"
},
{
"id": 3,
"type": "timeseries",
"title": "Points per Day",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 6,
"w": 10,
"x": 14,
"y": 10
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "WITH days AS (\n SELECT generate_series(\n date_trunc('day', now() - interval '30 days'),\n date_trunc('day', now()),\n interval '1 day'\n ) AS day\n)\nSELECT\n days.day AS \"time\",\n count(points.id)::double precision AS points\nFROM days\nLEFT JOIN points\n ON to_timestamp(points.timestamp) >= days.day\n AND to_timestamp(points.timestamp) < days.day + interval '1 day'\nGROUP BY days.day\nORDER BY days.day;"
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "bars",
"fillOpacity": 70,
"lineWidth": 1,
"showPoints": "never",
"axisPlacement": "auto",
"barAlignment": 0
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"options": {
"legend": {
"calcs": [
"sum"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "13.0.2"
},
{
"id": 4,
"type": "table",
"title": "Recent Tracks",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 16
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\n start_at AS \"start\",\n end_at AS \"end\",\n round((distance::numeric / 1000.0), 2)::double precision AS km,\n round((duration::numeric / 60.0), 1)::double precision AS minutes\nFROM tracks\nWHERE start_at >= now() - interval '30 days'\nORDER BY start_at DESC\nLIMIT 50;"
}
],
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "km"
},
"properties": [
{
"id": "unit",
"value": "km"
}
]
},
{
"matcher": {
"id": "byName",
"options": "minutes"
},
"properties": [
{
"id": "unit",
"value": "m"
}
]
}
]
},
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "13.0.2"
}
],
"refresh": "5m",
"schemaVersion": 41,
"tags": [
"homelab",
"dawarich"
],
"templating": {
"list": []
},
"time": {
"from": "now-30d",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "Dawarich",
"uid": "dawarich",
"version": 3,
"weekStart": ""
}