diff --git a/dashboards/DatabaseDashboadInfo.json b/dashboards/DatabaseDashboadInfo.json
index 9260ab7..1c1b89e 100644
--- a/dashboards/DatabaseDashboadInfo.json
+++ b/dashboards/DatabaseDashboadInfo.json
@@ -5,11 +5,11 @@
"type": "grafana",
"id": "grafana",
"name": "Grafana",
- "version": "10.1.2"
+ "version": "11.2.3"
},
{
"type": "datasource",
- "id": "postgres",
+ "id": "grafana-postgresql-datasource",
"name": "PostgreSQL",
"version": "1.0.0"
},
@@ -40,9 +40,9 @@
"type": "grafana",
"uid": "-- Grafana --"
},
+ "definition": "TeslaMate|U2FsdGVkX1/cEWK+8cz7pjEKXtzJnDN7b21ZDXt1MGneFGPWTLqOPtxKmu02mJPLzi/f29I+NBHd3vi0FB8R4Xn0+GtobWDgk6VAVSBTdSNniOKO8i2WPlhRaOsl2+hG7gnZ7wrf1Th2nxR7f1uYCrbwOek0IzkfLzrkjh7gkr6inT6bbDuJqrmogZajLxmAMrQ6V+/vHxBRGiwjJhgiEeq3hM1q2h04JKkNiZ8RHbsF5Cd/xd8Q9u0JVrZzIrtnhM/SFlaApU7RtRMu8CSj1llTX7WEOj6VDZAMSf+XUAanWdk725kEPN9MNu89o2zEq5P3E3cju8IbbBdPzXLV3oVuzD6/tMnxFToIIV1E/BrpF7s2RtNa8+KJJ1PF8xgs6m+/KTD2hy+WsP0636AgObRAmYg7+qotGrgNvpNPdE0EgrB7WHYlV7R/1q66bcq6tCe51X1Un70k+zo+K6AK0o4B1H6IyMlEVuRH/Fz8QVl9aYu2ztd08RbuKJlYVKpkH+pxVETAO9MclYQ90tzE6TfwDZrQZzsAlMenr4s1ZB1OlFXjLjVjnddnUilzO76cqv4yI2THQEuyQ47nuVQ4gUbx02K59vMQhns3C01JOAYokOaSXe66Y7QYdMlk09Lf|aes-256-cbc",
"enable": true,
"hide": true,
- "definition": "TeslaMate|U2FsdGVkX1/cEWK+8cz7pjEKXtzJnDN7b21ZDXt1MGneFGPWTLqOPtxKmu02mJPLzi/f29I+NBHd3vi0FB8R4Xn0+GtobWDgk6VAVSBTdSNniOKO8i2WPlhRaOsl2+hG7gnZ7wrf1Th2nxR7f1uYCrbwOek0IzkfLzrkjh7gkr6inT6bbDuJqrmogZajLxmAMrQ6V+/vHxBRGiwjJhgiEeq3hM1q2h04JKkNiZ8RHbsF5Cd/xd8Q9u0JVrZzIrtnhM/SFlaApU7RtRMu8CSj1llTX7WEOj6VDZAMSf+XUAanWdk725kEPN9MNu89o2zEq5P3E3cju8IbbBdPzXLV3oVuzD6/tMnxFToIIV1E/BrpF7s2RtNa8+KJJ1PF8xgs6m+/KTD2hy+WsP0636AgObRAmYg7+qotGrgNvpNPdE0EgrB7WHYlV7R/1q66bcq6tCe51X1Un70k+zo+K6AK0o4B1H6IyMlEVuRH/Fz8QVl9aYu2ztd08RbuKJlYVKpkH+pxVETAO9MclYQ90tzE6TfwDZrQZzsAlMenr4s1ZB1OlFXjLjVjnddnUilzO76cqv4yI2THQEuyQ47nuVQ4gUbx02K59vMQhns3C01JOAYokOaSXe66Y7QYdMlk09Lf|aes-256-cbc",
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
@@ -92,11 +92,10 @@
"url": ""
}
],
- "liveNow": false,
"panels": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
@@ -130,6 +129,7 @@
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
+ "percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -137,22 +137,25 @@
"fields": "/.*/",
"values": false
},
- "textMode": "value_and_name"
+ "showPercentChange": false,
+ "textMode": "value_and_name",
+ "wideLayout": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
+ "editorMode": "code",
"format": "table",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
- "rawSql": "SELECT ROUND(convert_km((max(odometer) - min(odometer))::numeric, '$length_unit'),0)|| ' $length_unit' as \"Logged\"\nfrom positions where car_id = $car_id;",
- "refId": "DistanceLogged",
+ "rawSql": "SELECT\n ROUND(convert_km(sum(distance)::numeric, '$length_unit'), 0) || ' $length_unit' as \"Logged\",\n ROUND(convert_km(max(end_km)::numeric, '$length_unit'), 0) || ' $length_unit' as \"Odometer\"\nfrom drives where car_id = $car_id;",
+ "refId": "A",
"select": [
[
{
@@ -163,39 +166,23 @@
}
]
],
- "table": "cars",
- "timeColumn": "inserted_at",
- "timeColumnType": "timestamp",
- "where": [
- {
- "name": "$__timeFilter",
- "params": [],
- "type": "macro"
- }
- ]
- },
- {
- "datasource": {
- "type": "postgres",
- "uid": "TeslaMate"
- },
- "format": "table",
- "group": [],
- "hide": false,
- "metricColumn": "none",
- "rawQuery": true,
- "rawSql": "select ROUND(convert_km(ROUND(odometer::numeric,0), '$length_unit'),0) || ' $length_unit' as \"Odometer\"\nfrom positions \nwhere car_id = $car_id\norder by date desc \nlimit 1;",
- "refId": "Odometer",
- "select": [
- [
+ "sql": {
+ "columns": [
{
- "params": [
- "efficiency"
- ],
- "type": "column"
+ "parameters": [],
+ "type": "function"
}
- ]
- ],
+ ],
+ "groupBy": [
+ {
+ "property": {
+ "type": "string"
+ },
+ "type": "groupBy"
+ }
+ ],
+ "limit": 50
+ },
"table": "cars",
"timeColumn": "inserted_at",
"timeColumnType": "timestamp",
@@ -213,7 +200,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
@@ -247,6 +234,7 @@
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
+ "percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -254,13 +242,15 @@
"fields": "/.*/",
"values": false
},
- "textMode": "value_and_name"
+ "showPercentChange": false,
+ "textMode": "value_and_name",
+ "wideLayout": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -311,7 +301,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -366,7 +356,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
@@ -400,6 +390,7 @@
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
+ "percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -407,13 +398,15 @@
"fields": "/.*/",
"values": false
},
- "textMode": "value_and_name"
+ "showPercentChange": false,
+ "textMode": "value_and_name",
+ "wideLayout": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -464,7 +457,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -497,7 +490,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
@@ -531,6 +524,7 @@
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
+ "percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -538,13 +532,15 @@
"fields": "/.*/",
"values": false
},
- "textMode": "value_and_name"
+ "showPercentChange": false,
+ "textMode": "value_and_name",
+ "wideLayout": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -595,7 +591,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -649,10 +645,6 @@
"type": "stat"
},
{
- "datasource": {
- "type": "postgres",
- "uid": "TeslaMate"
- },
"gridPos": {
"h": 4,
"w": 4,
@@ -669,41 +661,7 @@
"content": "You can go to the \nIncomplete Data dashboard
\nto see details of the **Drives** or **Charges** not closed.\n",
"mode": "markdown"
},
- "pluginVersion": "10.1.2",
- "targets": [
- {
- "datasource": {
- "type": "postgres",
- "uid": "TeslaMate"
- },
- "format": "time_series",
- "group": [],
- "metricColumn": "none",
- "rawQuery": false,
- "rawSql": "SELECT\n start_date AS \"time\",\n start_km\nFROM drives\nWHERE\n $__timeFilter(start_date)\nORDER BY 1",
- "refId": "A",
- "select": [
- [
- {
- "params": [
- "start_km"
- ],
- "type": "column"
- }
- ]
- ],
- "table": "drives",
- "timeColumn": "start_date",
- "timeColumnType": "timestamp",
- "where": [
- {
- "name": "$__timeFilter",
- "params": [],
- "type": "macro"
- }
- ]
- }
- ],
+ "pluginVersion": "11.2.3",
"title": "About incomplete data",
"type": "text"
},
@@ -722,7 +680,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"fieldConfig": {
@@ -731,11 +689,12 @@
"mode": "thresholds"
},
"custom": {
- "align": "auto",
+ "align": "right",
"cellOptions": {
"type": "auto"
},
- "inspect": false
+ "inspect": false,
+ "width": 100
},
"mappings": [],
"thresholds": {
@@ -750,22 +709,22 @@
"value": 80
}
]
- }
+ },
+ "unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
- "options": "Size"
+ "options": "Table"
},
"properties": [
{
"id": "custom.align",
- "value": "right"
+ "value": "auto"
},
{
- "id": "custom.width",
- "value": 150
+ "id": "custom.width"
}
]
}
@@ -773,7 +732,7 @@
},
"gridPos": {
"h": 16,
- "w": 5,
+ "w": 6,
"x": 0,
"y": 5
},
@@ -790,17 +749,17 @@
},
"showHeader": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
- "rawSql": "SELECT \r\n relname AS \"Table\",\r\n pg_size_pretty(pg_total_relation_size(relid)) As \"Size\"\r\nFROM \r\n pg_catalog.pg_statio_user_tables\r\nORDER BY \r\n pg_total_relation_size(relid) DESC;",
+ "rawSql": "SELECT \r\n relname AS \"Table\",\r\n pg_relation_size(relid) as \"Data\",\r\n pg_indexes_size(relid) as \"Indexes\",\r\n pg_total_relation_size(relid) As \"Total\"\r\nFROM \r\n pg_catalog.pg_statio_user_tables\r\nORDER BY \r\n pg_total_relation_size(relid) DESC;",
"refId": "A",
"sql": {
"columns": [
@@ -825,7 +784,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"fieldConfig": {
@@ -876,8 +835,8 @@
},
"gridPos": {
"h": 16,
- "w": 5,
- "x": 5,
+ "w": 4,
+ "x": 6,
"y": 5
},
"id": 38,
@@ -893,17 +852,17 @@
},
"showHeader": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
- "rawSql": "SELECT table_name AS \"Table Name\", \r\n (xpath('/row/cnt/text()', xml_count))[1]::text::int AS \"Row Count\"\r\nFROM (\r\n SELECT table_name, \r\n query_to_xml(format('SELECT count(*) as cnt FROM %I.%I', table_schema, table_name), false, true, '') AS xml_count\r\n FROM information_schema.tables\r\n WHERE table_schema NOT IN ('pg_catalog', 'information_schema')\r\n) AS t\r\nORDER BY 2 DESC;",
+ "rawSql": "SELECT table_name AS \"Table Name\", \r\n (xpath('/row/cnt/text()', xml_count))[1]::text::int AS \"Row Count\"\r\nFROM (\r\n SELECT table_name, \r\n query_to_xml(format('SELECT count(*) as cnt FROM %I.%I', table_schema, table_name), false, true, '') AS xml_count\r\n FROM information_schema.tables\r\n WHERE table_schema NOT IN ('pg_catalog', 'information_schema') and table_type = 'BASE TABLE'\r\n) AS t\r\nORDER BY 2 DESC;",
"refId": "A",
"sql": {
"columns": [
@@ -928,7 +887,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "These statistics can help you evaluate the efficiency of your indexes.\n\nYou should reindex all the database periodically.",
@@ -938,11 +897,12 @@
"mode": "thresholds"
},
"custom": {
- "align": "auto",
+ "align": "right",
"cellOptions": {
"type": "auto"
},
- "inspect": false
+ "inspect": false,
+ "width": 120
},
"mappings": [],
"thresholds": {
@@ -959,7 +919,51 @@
]
}
},
- "overrides": []
+ "overrides": [
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Index Size"
+ },
+ "properties": [
+ {
+ "id": "unit",
+ "value": "bytes"
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Table"
+ },
+ "properties": [
+ {
+ "id": "custom.width",
+ "value": 200
+ },
+ {
+ "id": "custom.align",
+ "value": "auto"
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Index"
+ },
+ "properties": [
+ {
+ "id": "custom.width"
+ },
+ {
+ "id": "custom.align",
+ "value": "auto"
+ }
+ ]
+ }
+ ]
},
"gridPos": {
"h": 16,
@@ -981,17 +985,17 @@
},
"showHeader": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
- "rawSql": "SELECT\r\n relname AS \"Table\",\r\n indexrelname AS \"Index\",\r\n idx_scan AS \"Index Scans\",\r\n idx_tup_read AS \"Tuples Read\",\r\n idx_tup_fetch AS \"Tuples Fetched\"\r\nFROM\r\n pg_stat_all_indexes\r\nWHERE\r\n schemaname NOT LIKE 'pg_%' AND\r\n indexrelname IS NOT NULL\r\nORDER BY 3 DESC;",
+ "rawSql": "SELECT\r\n relname AS \"Table\",\r\n indexrelname AS \"Index\",\r\n idx_scan AS \"Index Scans\",\r\n idx_tup_read AS \"Tuples Read\",\r\n idx_tup_fetch AS \"Tuples Fetched\",\r\n PG_RELATION_SIZE(indexrelid) as \"Index Size\"\r\nFROM\r\n pg_stat_all_indexes\r\nWHERE\r\n schemaname NOT LIKE 'pg_%' AND\r\n indexrelname IS NOT NULL\r\nORDER BY 3 DESC;",
"refId": "A",
"sql": {
"columns": [
@@ -1017,7 +1021,7 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
@@ -1035,13 +1039,14 @@
"value": null
}
]
- }
+ },
+ "unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 3,
- "w": 10,
+ "w": 8,
"x": 0,
"y": 21
},
@@ -1051,6 +1056,7 @@
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
+ "percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -1058,13 +1064,15 @@
"fields": "/.*/",
"values": false
},
- "textMode": "value"
+ "showPercentChange": false,
+ "textMode": "value",
+ "wideLayout": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -1073,7 +1081,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
- "rawSql": "SELECT \n pg_size_pretty(SUM(pg_total_relation_size(relid))) As \"Size\"\nFROM \n pg_catalog.pg_statio_user_tables;",
+ "rawSql": "SELECT \n SUM(pg_total_relation_size(relid)) As \"Size\"\nFROM \n pg_catalog.pg_statio_user_tables;",
"refId": "DistanceLogged",
"select": [
[
@@ -1119,7 +1127,112 @@
},
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "mappings": [],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "super-light-blue",
+ "value": null
+ }
+ ]
+ }
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 8,
+ "x": 8,
+ "y": 21
+ },
+ "id": 50,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "none",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "percentChangeColorMode": "standard",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "/.*/",
+ "values": false
+ },
+ "showPercentChange": false,
+ "textMode": "value",
+ "wideLayout": true
+ },
+ "pluginVersion": "11.2.3",
+ "targets": [
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "editorMode": "code",
+ "format": "table",
+ "group": [],
+ "hide": false,
+ "metricColumn": "none",
+ "rawQuery": true,
+ "rawSql": "show timezone;",
+ "refId": "DistanceLogged",
+ "select": [
+ [
+ {
+ "params": [
+ "efficiency"
+ ],
+ "type": "column"
+ }
+ ]
+ ],
+ "sql": {
+ "columns": [
+ {
+ "parameters": [],
+ "type": "function"
+ }
+ ],
+ "groupBy": [
+ {
+ "property": {
+ "type": "string"
+ },
+ "type": "groupBy"
+ }
+ ],
+ "limit": 50
+ },
+ "table": "cars",
+ "timeColumn": "inserted_at",
+ "timeColumnType": "timestamp",
+ "where": [
+ {
+ "name": "$__timeFilter",
+ "params": [],
+ "type": "macro"
+ }
+ ]
+ }
+ ],
+ "title": "Timezone",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"description": "",
@@ -1150,8 +1263,8 @@
},
"gridPos": {
"h": 3,
- "w": 14,
- "x": 10,
+ "w": 8,
+ "x": 16,
"y": 21
},
"id": 43,
@@ -1160,6 +1273,7 @@
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
+ "percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@@ -1167,13 +1281,15 @@
"fields": "/.*/",
"values": false
},
- "textMode": "value_and_name"
+ "showPercentChange": false,
+ "textMode": "value_and_name",
+ "wideLayout": true
},
- "pluginVersion": "10.1.2",
+ "pluginVersion": "11.2.3",
"targets": [
{
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
@@ -1203,54 +1319,671 @@
],
"title": "About Teslamate Custom Dashboards",
"type": "stat"
- }
- ],
- "refresh": "",
- "schemaVersion": 38,
- "style": "dark",
- "tags": [
- "TeslamateCustomDashboards"
- ],
- "templating": {
- "list": [
- {
- "current": {},
- "datasource": {
- "type": "postgres",
- "uid": "TeslaMate"
- },
- "definition": "select unit_of_length from settings limit 1;",
- "hide": 2,
- "includeAll": false,
- "label": "",
- "multi": false,
- "name": "length_unit",
- "options": [],
- "query": "select unit_of_length from settings limit 1;",
- "refresh": 1,
- "regex": "",
- "skipUrlSync": false,
- "sort": 0,
- "tagValuesQuery": "",
- "tagsQuery": "",
- "type": "query",
- "useTags": false
+ },
+ {
+ "collapsed": false,
+ "gridPos": {
+ "h": 1,
+ "w": 24,
+ "x": 0,
+ "y": 24
+ },
+ "id": 44,
+ "panels": [],
+ "title": "Statistics of SQL planning and execution",
+ "type": "row"
+ },
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "mappings": [],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "super-light-blue",
+ "value": null
+ }
+ ]
+ }
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 6,
+ "x": 0,
+ "y": 25
+ },
+ "id": 48,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "none",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "percentChangeColorMode": "standard",
+ "reduceOptions": {
+ "calcs": [],
+ "fields": "/.*/",
+ "values": false
+ },
+ "showPercentChange": false,
+ "textMode": "value",
+ "wideLayout": true
+ },
+ "pluginVersion": "11.2.3",
+ "targets": [
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "editorMode": "code",
+ "format": "table",
+ "group": [],
+ "hide": false,
+ "metricColumn": "none",
+ "rawQuery": true,
+ "rawSql": "${pg_stat_statements_info_last_reset:raw}",
+ "refId": "Charges",
+ "select": [
+ [
+ {
+ "params": [
+ "efficiency"
+ ],
+ "type": "column"
+ }
+ ]
+ ],
+ "sql": {
+ "columns": [
+ {
+ "parameters": [],
+ "type": "function"
+ }
+ ],
+ "groupBy": [
+ {
+ "property": {
+ "type": "string"
+ },
+ "type": "groupBy"
+ }
+ ],
+ "limit": 50
+ },
+ "table": "cars",
+ "timeColumn": "inserted_at",
+ "timeColumnType": "timestamp",
+ "where": [
+ {
+ "name": "$__timeFilter",
+ "params": [],
+ "type": "macro"
+ }
+ ]
+ }
+ ],
+ "title": "Time at which all statistics in the pg_stat_statements view were last reset",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "mappings": [],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "super-light-blue",
+ "value": null
+ }
+ ]
+ }
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 6,
+ "x": 6,
+ "y": 25
+ },
+ "id": 49,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "none",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "percentChangeColorMode": "standard",
+ "reduceOptions": {
+ "calcs": [],
+ "fields": "/.*/",
+ "values": false
+ },
+ "showPercentChange": false,
+ "textMode": "value",
+ "wideLayout": true
+ },
+ "pluginVersion": "11.2.3",
+ "targets": [
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "editorMode": "code",
+ "format": "table",
+ "group": [],
+ "hide": false,
+ "metricColumn": "none",
+ "rawQuery": true,
+ "rawSql": "${pg_stat_statements_count:raw}",
+ "refId": "Charges",
+ "select": [
+ [
+ {
+ "params": [
+ "efficiency"
+ ],
+ "type": "column"
+ }
+ ]
+ ],
+ "sql": {
+ "columns": [
+ {
+ "parameters": [],
+ "type": "function"
+ }
+ ],
+ "groupBy": [
+ {
+ "property": {
+ "type": "string"
+ },
+ "type": "groupBy"
+ }
+ ],
+ "limit": 50
+ },
+ "table": "cars",
+ "timeColumn": "inserted_at",
+ "timeColumnType": "timestamp",
+ "where": [
+ {
+ "name": "$__timeFilter",
+ "params": [],
+ "type": "macro"
+ }
+ ]
+ }
+ ],
+ "title": "Number of Statements tracked via pg_stat_statements",
+ "type": "stat"
+ },
+ {
+ "gridPos": {
+ "h": 3,
+ "w": 12,
+ "x": 12,
+ "y": 25
+ },
+ "id": 47,
+ "options": {
+ "code": {
+ "language": "plaintext",
+ "showLineNumbers": false,
+ "showMiniMap": false
+ },
+ "content": "See the [contribution docs](https://docs.teslamate.org/docs/development#enable-pg_stat_statements-to-collect-query-statistics) on how to enable tracking planning and execution statistics of all SQL statements executed by a server.\n",
+ "mode": "markdown"
+ },
+ "pluginVersion": "11.2.3",
+ "title": "About pg_stat_statements (track statistics of SQL planning and execution)",
+ "type": "text"
+ },
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "custom": {
+ "align": "auto",
+ "cellOptions": {
+ "type": "auto",
+ "wrapText": false
+ },
+ "inspect": false
+ },
+ "mappings": [],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "green",
+ "value": null
+ },
+ {
+ "color": "red",
+ "value": 80
+ }
+ ]
+ },
+ "unit": "ms"
+ },
+ "overrides": [
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Calls"
+ },
+ "properties": [
+ {
+ "id": "unit",
+ "value": "none"
+ },
+ {
+ "id": "custom.width",
+ "value": 80
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Query"
+ },
+ "properties": [
+ {
+ "id": "custom.inspect",
+ "value": true
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Mean Exec Time"
+ },
+ "properties": [
+ {
+ "id": "custom.width",
+ "value": 140
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Total Exec Time"
+ },
+ "properties": [
+ {
+ "id": "custom.width",
+ "value": 140
+ }
+ ]
+ }
+ ]
+ },
+ "gridPos": {
+ "h": 14,
+ "w": 12,
+ "x": 0,
+ "y": 28
+ },
+ "id": 45,
+ "options": {
+ "cellHeight": "sm",
+ "footer": {
+ "countRows": false,
+ "enablePagination": true,
+ "fields": "",
+ "reducer": [
+ "sum"
+ ],
+ "show": false
+ },
+ "showHeader": true,
+ "sortBy": []
+ },
+ "pluginVersion": "11.2.3",
+ "targets": [
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "editorMode": "code",
+ "format": "table",
+ "rawQuery": true,
+ "rawSql": "${pg_stat_statements_top_20_mean:raw}",
+ "refId": "A",
+ "sql": {
+ "columns": [
+ {
+ "parameters": [],
+ "type": "function"
+ }
+ ],
+ "groupBy": [
+ {
+ "property": {
+ "type": "string"
+ },
+ "type": "groupBy"
+ }
+ ],
+ "limit": 50
+ }
+ }
+ ],
+ "title": "Top 20 Statements (by mean time spent executing the statement)",
+ "type": "table"
+ },
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "custom": {
+ "align": "auto",
+ "cellOptions": {
+ "type": "auto",
+ "wrapText": false
+ },
+ "inspect": false
+ },
+ "mappings": [],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "green",
+ "value": null
+ },
+ {
+ "color": "red",
+ "value": 80
+ }
+ ]
+ },
+ "unit": "ms"
+ },
+ "overrides": [
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Calls"
+ },
+ "properties": [
+ {
+ "id": "unit",
+ "value": "none"
+ },
+ {
+ "id": "custom.width",
+ "value": 80
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Query"
+ },
+ "properties": [
+ {
+ "id": "custom.inspect",
+ "value": true
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Mean Exec Time"
+ },
+ "properties": [
+ {
+ "id": "custom.width",
+ "value": 140
+ }
+ ]
+ },
+ {
+ "matcher": {
+ "id": "byName",
+ "options": "Total Exec Time"
+ },
+ "properties": [
+ {
+ "id": "custom.width",
+ "value": 140
+ }
+ ]
+ }
+ ]
+ },
+ "gridPos": {
+ "h": 14,
+ "w": 12,
+ "x": 12,
+ "y": 28
+ },
+ "id": 46,
+ "options": {
+ "cellHeight": "sm",
+ "footer": {
+ "countRows": false,
+ "enablePagination": true,
+ "fields": "",
+ "reducer": [
+ "sum"
+ ],
+ "show": false
+ },
+ "showHeader": true,
+ "sortBy": []
+ },
+ "pluginVersion": "11.2.3",
+ "targets": [
+ {
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "editorMode": "code",
+ "format": "table",
+ "rawQuery": true,
+ "rawSql": "${pg_stat_statements_top_20_total:raw}",
+ "refId": "A",
+ "sql": {
+ "columns": [
+ {
+ "parameters": [],
+ "type": "function"
+ }
+ ],
+ "groupBy": [
+ {
+ "property": {
+ "type": "string"
+ },
+ "type": "groupBy"
+ }
+ ],
+ "limit": 50
+ }
+ }
+ ],
+ "title": "Top 20 Statements (by total time spent executing the statement)",
+ "type": "table"
+ }
+ ],
+ "refresh": "",
+ "schemaVersion": 39,
+ "tags": [
+ "TeslamateCustomDashboards"
+ ],
+ "templating": {
+ "list": [
+ {
+ "current": {},
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "definition": "select unit_of_length from settings limit 1;",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "length_unit",
+ "options": [],
+ "query": "select unit_of_length from settings limit 1;",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "type": "query"
},
{
"current": {},
"datasource": {
- "type": "postgres",
+ "type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
- "definition": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
- "description": "",
+ "definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
- "query": "SELECT name AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
+ "query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "type": "query"
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "definition": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'SELECT stats_reset FROM pg_stat_statements_info;' else 'SELECT NULL;' end",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "pg_stat_statements_info_last_reset",
+ "options": [],
+ "query": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'SELECT stats_reset FROM pg_stat_statements_info;' else 'SELECT NULL;' end",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "type": "query"
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "definition": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'SELECT count(*) FROM pg_stat_statements;' else 'SELECT NULL;' end",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "pg_stat_statements_count",
+ "options": [],
+ "query": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'SELECT count(*) FROM pg_stat_statements;' else 'SELECT NULL;' end",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "type": "query"
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "definition": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'select\n calls as \"Calls\",\n mean_exec_time as \"Mean Exec Time\",\n total_exec_time as \"Total Exec Time\",\n query as \"Query\"\nfrom pg_stat_statements\nORDER BY mean_exec_time desc\nlimit 20;' else 'SELECT NULL;' end",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "pg_stat_statements_top_20_mean",
+ "options": [],
+ "query": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'select\n calls as \"Calls\",\n mean_exec_time as \"Mean Exec Time\",\n total_exec_time as \"Total Exec Time\",\n query as \"Query\"\nfrom pg_stat_statements\nORDER BY mean_exec_time desc\nlimit 20;' else 'SELECT NULL;' end",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "type": "query"
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "definition": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'select\n calls as \"Calls\",\n mean_exec_time as \"Mean Exec Time\",\n total_exec_time as \"Total Exec Time\",\n query as \"Query\"\nfrom pg_stat_statements\nORDER BY total_exec_time desc\nlimit 20;' else 'SELECT NULL;' end",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "pg_stat_statements_top_20_total",
+ "options": [],
+ "query": "SELECT\n CASE WHEN $pg_stat_statements_enabled = 1 THEN 'select\n calls as \"Calls\",\n mean_exec_time as \"Mean Exec Time\",\n total_exec_time as \"Total Exec Time\",\n query as \"Query\"\nfrom pg_stat_statements\nORDER BY total_exec_time desc\nlimit 20;' else 'SELECT NULL;' end",
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 0,
+ "type": "query"
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "grafana-postgresql-datasource",
+ "uid": "TeslaMate"
+ },
+ "definition": "SELECT EXISTS (\nSELECT 1\nFROM information_schema.tables\nWHERE table_name = 'pg_stat_statements'\n)::int AS table_existence",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "pg_stat_statements_enabled",
+ "options": [],
+ "query": "SELECT EXISTS (\nSELECT 1\nFROM information_schema.tables\nWHERE table_name = 'pg_stat_statements'\n)::int AS table_existence",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
@@ -1270,6 +2003,6 @@
"timezone": "browser",
"title": "Database Information",
"uid": "jchm_dbInfo",
- "version": 3,
+ "version": 1,
"weekStart": ""
}
\ No newline at end of file