{ "__inputs": [ { "name": "DS_MYSQL-TRAIN-TRACKER", "label": "mysql-train-tracker", "description": "", "type": "datasource", "pluginId": "mysql", "pluginName": "MySQL" } ], "__elements": {}, "__requires": [ { "type": "panel", "id": "geomap", "name": "Geomap", "version": "" }, { "type": "grafana", "id": "grafana", "name": "Grafana", "version": "11.4.0" }, { "type": "datasource", "id": "mysql", "name": "MySQL", "version": "11.3.1" }, { "type": "panel", "id": "table", "name": "Table", "version": "" } ], "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": null, "links": [], "panels": [ { "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "hideFrom": { "legend": false, "tooltip": false, "viz": false } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 19, "w": 16, "x": 0, "y": 0 }, "id": 1, "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": "dark-green" }, "opacity": 0.4, "rotation": { "fixed": 0, "max": 360, "min": -360, "mode": "mod" }, "size": { "fixed": 5, "max": 15, "min": 2 }, "symbol": { "fixed": "img/icons/marker/circle.svg", "mode": "fixed" }, "symbolAlign": { "horizontal": "center", "vertical": "center" }, "textConfig": { "fontSize": 12, "offsetX": 0, "offsetY": 0, "textAlign": "center", "textBaseline": "middle" } } }, "location": { "mode": "auto" }, "name": "Layer 1", "tooltip": true, "type": "markers" } ], "tooltip": { "mode": "details" }, "view": { "allLayers": true, "id": "fit", "lat": 0, "lon": 0, "zoom": 15 } }, "pluginVersion": "11.4.0", "targets": [ { "dataset": "mysql", "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "editorMode": "code", "format": "table", "rawQuery": true, "rawSql": "SELECT\n timestamp AS \"time\",\n latitude,\n longitude,\n train_name,\n fahrt_nr,\n destination,\n delay / 60 AS delay_minutes\nFROM traindb.trips\nWHERE\n $__timeFilter(timestamp) AND\n train_name IN (${train_name:sqlstring})\nORDER BY timestamp\n", "refId": "A", "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 } } ], "title": "Abfahrten Züge", "type": "geomap" }, { "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "left", "cellOptions": { "mode": "gradient", "type": "color-background" }, "filterable": false, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 5 }, { "color": "red", "value": 20 } ] } }, "overrides": [] }, "gridPos": { "h": 10, "w": 8, "x": 16, "y": 0 }, "id": 4, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": [ "Verspätung in Min" ], "reducer": [ "sum" ], "show": false }, "showHeader": true, "sortBy": [ { "desc": true, "displayName": "Verspätung in Min" } ] }, "pluginVersion": "11.4.0", "targets": [ { "dataset": "traindb", "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "editorMode": "code", "format": "table", "rawQuery": true, "rawSql": "SELECT\ntrain_name AS \"Zugname\", \nfahrt_nr AS \"Fahrtnummer\", \ndelay / 60 AS \"Verspätung in Min\"\nFROM traindb.today_delay_stats\nWHERE\n train_name IN (${train_name:sqlstring}) AND fahrt_nr IN (${fahrt_nr:sqlstring})\nORDER BY train_name", "refId": "A", "sql": { "columns": [ { "parameters": [ { "name": "train_name", "type": "functionParameter" } ], "type": "function" }, { "parameters": [ { "name": "fahrt_nr", "type": "functionParameter" } ], "type": "function" }, { "parameters": [ { "name": "delay", "type": "functionParameter" } ], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "today_delay_stats" } ], "title": "Statistik Heute Insgesamt", "type": "table" }, { "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "left", "cellOptions": { "type": "color-background" }, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 5 }, { "color": "red", "value": 20 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "Fahrtnummer" }, "properties": [ { "id": "custom.width", "value": 120 } ] }, { "matcher": { "id": "byName", "options": "Züge insgesamt" }, "properties": [ { "id": "custom.width", "value": 140 } ] }, { "matcher": { "id": "byName", "options": "Verspäte Züge" }, "properties": [ { "id": "custom.width", "value": 140 } ] }, { "matcher": { "id": "byName", "options": "Verspätung in Min" }, "properties": [] } ] }, "gridPos": { "h": 9, "w": 8, "x": 16, "y": 10 }, "id": 2, "options": { "cellHeight": "sm", "footer": { "countRows": false, "enablePagination": false, "fields": "", "reducer": [ "sum" ], "show": false }, "showHeader": true, "sortBy": [ { "desc": true, "displayName": "Verspätung in Min" } ] }, "pluginVersion": "11.4.0", "targets": [ { "dataset": "traindb", "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "editorMode": "code", "format": "table", "rawQuery": true, "rawSql": "SELECT\nfahrt_nr AS \"Fahrtnummer\", \ntotal_trips AS \"Züge insgesamt\",\ndelayed_trips AS \"Verspäte Züge\",\navg_delay / 60 AS \"Verspätung in Min\"\nFROM traindb.delay_stats\nWHERE\n fahrt_nr IN (${fahrt_nr:sqlstring})\nORDER BY fahrt_nr", "refId": "A", "sql": { "columns": [ { "parameters": [ { "name": "total_trips", "type": "functionParameter" } ], "type": "function" }, { "parameters": [ { "name": "delayed_trips", "type": "functionParameter" } ], "type": "function" }, { "parameters": [ { "name": "avg_delay", "type": "functionParameter" } ], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "delay_stats" } ], "title": "Statistik Insgesamt", "type": "table" } ], "refresh": "1m", "schemaVersion": 40, "tags": [], "templating": { "list": [ { "current": {}, "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "definition": "SELECT\n train_name\nFROM traindb.trips", "includeAll": true, "label": "Zugname", "multi": true, "name": "train_name", "options": [], "query": "SELECT\n train_name\nFROM traindb.trips", "refresh": 1, "regex": "", "sort": 1, "type": "query" }, { "current": {}, "datasource": { "type": "mysql", "uid": "${DS_MYSQL-TRAIN-TRACKER}" }, "definition": "SELECT\n fahrt_nr\nFROM traindb.trips\nWHERE\n train_name IN (${train_name:sqlstring})", "includeAll": true, "label": "Fahrtnummer", "multi": true, "name": "fahrt_nr", "options": [], "query": "SELECT\n fahrt_nr\nFROM traindb.trips\nWHERE\n train_name IN (${train_name:sqlstring})", "refresh": 1, "regex": "", "type": "query" } ] }, "time": { "from": "now/d", "to": "now/d" }, "timepicker": {}, "timezone": "Europe/Berlin", "title": "Train Tracker", "uid": "bdz979doey5tsa", "version": 11, "weekStart": "" }