Replace Dawarich Grafana dashboard

This commit is contained in:
2026-06-22 19:55:47 +02:00
parent 3bebc03a8f
commit b8d9bba5d3
2 changed files with 1202 additions and 412 deletions
+595 -200
View File
@@ -20,12 +20,360 @@
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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';",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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';",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"fieldConfig": {
"defaults": {
"custom": {
@@ -44,18 +392,10 @@
"value": null
}
]
},
"unit": "none"
}
},
"overrides": []
},
"gridPos": {
"h": 16,
"w": 16,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"basemap": {
"config": {},
@@ -73,42 +413,29 @@
"layers": [
{
"config": {
"showLegend": true,
"showLegend": false,
"style": {
"color": {
"fixed": "dark-green"
},
"opacity": 0.55,
"rotation": {
"fixed": 0,
"max": 360,
"min": -360,
"mode": "mod"
"fixed": "green"
},
"opacity": 0.7,
"size": {
"fixed": 4,
"fixed": 5,
"max": 15,
"min": 2
},
"symbol": {
"fixed": "img/icons/marker/circle.svg",
"mode": "fixed"
},
"textConfig": {
"fontSize": 12,
"offsetX": 0,
"offsetY": 0,
"textAlign": "center",
"textBaseline": "middle"
}
}
},
"location": {
"latitude": "latitude",
"longitude": "longitude",
"latitude": "lat",
"longitude": "lon",
"mode": "coords"
},
"name": "Location points",
"name": "Points",
"tooltip": true,
"type": "markers"
}
@@ -119,14 +446,201 @@
"view": {
"allLayers": true,
"id": "fit",
"lat": 51,
"lon": 10,
"zoom": 5
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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"
}
}
},
{
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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"
}
}
},
{
"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"
@@ -134,53 +648,32 @@
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\n to_timestamp(timestamp) AS \"time\",\n ST_Y(lonlat::geometry) AS latitude,\n ST_X(lonlat::geometry) AS longitude,\n accuracy,\n tracker_id\nFROM points\nWHERE $__unixEpochFilter(timestamp)\n AND lonlat IS NOT NULL\nORDER BY timestamp DESC\nLIMIT 20000;",
"refId": "A"
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"title": "Location Points",
"type": "geomap"
},
"groupBy": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 70,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
"align": "auto",
"cellOptions": {
"type": "auto"
}
},
"mappings": [],
@@ -192,152 +685,54 @@
"value": null
}
]
},
"unit": "km"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [
"sum"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "13.0.2",
"targets": [
"overrides": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n make_date(year, month, 1)::timestamp AS \"time\",\n round((distance::numeric / 1000.0), 2) AS \"km\"\nFROM stats\nWHERE make_date(year, month, 1)::timestamp BETWEEN $__timeFrom() AND $__timeTo()\nORDER BY 1;",
"refId": "A"
}
],
"title": "Kilometers per Month",
"type": "timeseries"
"matcher": {
"id": "byName",
"options": "km"
},
"properties": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 70,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"id": "unit",
"value": "km"
}
]
},
"unit": "short"
{
"matcher": {
"id": "byName",
"options": "minutes"
},
"overrides": []
"properties": [
{
"id": "unit",
"value": "m"
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 8
},
"id": 3,
"options": {
"legend": {
"calcs": [
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
"show": false
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
"showHeader": true
}
},
"pluginVersion": "13.0.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n date_trunc('day', to_timestamp(timestamp)) AS \"time\",\n count(*) AS \"points\"\nFROM points\nWHERE $__unixEpochFilter(timestamp)\nGROUP BY 1\nORDER BY 1;",
"refId": "A"
}
],
"title": "Points per Day",
"type": "timeseries"
}
],
"preload": false,
"refresh": "5m",
"schemaVersion": 41,
"tags": [
"dawarich",
"location"
"homelab",
"dawarich"
],
"templating": {
"list": []
@@ -350,6 +745,6 @@
"timezone": "browser",
"title": "Dawarich",
"uid": "dawarich",
"version": 1,
"version": 2,
"weekStart": ""
}
+595 -200
View File
@@ -20,12 +20,360 @@
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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';",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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';",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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": "",
"values": false
},
"textMode": "auto",
"wideLayout": true
}
},
{
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"fieldConfig": {
"defaults": {
"custom": {
@@ -44,18 +392,10 @@
"value": null
}
]
},
"unit": "none"
}
},
"overrides": []
},
"gridPos": {
"h": 16,
"w": 16,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"basemap": {
"config": {},
@@ -73,42 +413,29 @@
"layers": [
{
"config": {
"showLegend": true,
"showLegend": false,
"style": {
"color": {
"fixed": "dark-green"
},
"opacity": 0.55,
"rotation": {
"fixed": 0,
"max": 360,
"min": -360,
"mode": "mod"
"fixed": "green"
},
"opacity": 0.7,
"size": {
"fixed": 4,
"fixed": 5,
"max": 15,
"min": 2
},
"symbol": {
"fixed": "img/icons/marker/circle.svg",
"mode": "fixed"
},
"textConfig": {
"fontSize": 12,
"offsetX": 0,
"offsetY": 0,
"textAlign": "center",
"textBaseline": "middle"
}
}
},
"location": {
"latitude": "latitude",
"longitude": "longitude",
"latitude": "lat",
"longitude": "lon",
"mode": "coords"
},
"name": "Location points",
"name": "Points",
"tooltip": true,
"type": "markers"
}
@@ -119,14 +446,201 @@
"view": {
"allLayers": true,
"id": "fit",
"lat": 51,
"lon": 10,
"zoom": 5
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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"
}
}
},
{
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"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"
}
}
},
{
"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"
@@ -134,53 +648,32 @@
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT\n to_timestamp(timestamp) AS \"time\",\n ST_Y(lonlat::geometry) AS latitude,\n ST_X(lonlat::geometry) AS longitude,\n accuracy,\n tracker_id\nFROM points\nWHERE $__unixEpochFilter(timestamp)\n AND lonlat IS NOT NULL\nORDER BY timestamp DESC\nLIMIT 20000;",
"refId": "A"
"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;",
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"title": "Location Points",
"type": "geomap"
},
"groupBy": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
}
}
],
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 70,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
"align": "auto",
"cellOptions": {
"type": "auto"
}
},
"mappings": [],
@@ -192,152 +685,54 @@
"value": null
}
]
},
"unit": "km"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [
"sum"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "13.0.2",
"targets": [
"overrides": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n make_date(year, month, 1)::timestamp AS \"time\",\n round((distance::numeric / 1000.0), 2) AS \"km\"\nFROM stats\nWHERE make_date(year, month, 1)::timestamp BETWEEN $__timeFrom() AND $__timeTo()\nORDER BY 1;",
"refId": "A"
}
],
"title": "Kilometers per Month",
"type": "timeseries"
"matcher": {
"id": "byName",
"options": "km"
},
"properties": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "bars",
"fillOpacity": 70,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"id": "unit",
"value": "km"
}
]
},
"unit": "short"
{
"matcher": {
"id": "byName",
"options": "minutes"
},
"overrides": []
"properties": [
{
"id": "unit",
"value": "m"
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 8
},
"id": 3,
"options": {
"legend": {
"calcs": [
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
"show": false
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
"showHeader": true
}
},
"pluginVersion": "13.0.2",
"targets": [
{
"datasource": {
"type": "postgres",
"uid": "dawarich-postgres"
},
"editorMode": "code",
"format": "time_series",
"rawQuery": true,
"rawSql": "SELECT\n date_trunc('day', to_timestamp(timestamp)) AS \"time\",\n count(*) AS \"points\"\nFROM points\nWHERE $__unixEpochFilter(timestamp)\nGROUP BY 1\nORDER BY 1;",
"refId": "A"
}
],
"title": "Points per Day",
"type": "timeseries"
}
],
"preload": false,
"refresh": "5m",
"schemaVersion": 41,
"tags": [
"dawarich",
"location"
"homelab",
"dawarich"
],
"templating": {
"list": []
@@ -350,6 +745,6 @@
"timezone": "browser",
"title": "Dawarich",
"uid": "dawarich",
"version": 1,
"version": 2,
"weekStart": ""
}