From cd86effeea4764d66dc477870b3cc48b828b204c Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Wed, 11 Sep 2024 12:52:58 +0200 Subject: [PATCH] fix_dashboard --- imageroot/etc/dashboards/network_traffic.json | 131 +++++++----------- 1 file changed, 52 insertions(+), 79 deletions(-) diff --git a/imageroot/etc/dashboards/network_traffic.json b/imageroot/etc/dashboards/network_traffic.json index c443d8d..7cd8aa2 100644 --- a/imageroot/etc/dashboards/network_traffic.json +++ b/imageroot/etc/dashboards/network_traffic.json @@ -1,53 +1,4 @@ { - "__inputs": [ - { - "name": "DS_GRAFANA-POSTGRESQL-DATASOURCE", - "label": "grafana-postgresql-datasource", - "description": "", - "type": "datasource", - "pluginId": "grafana-postgresql-datasource", - "pluginName": "PostgreSQL" - } - ], - "__elements": {}, - "__requires": [ - { - "type": "panel", - "id": "barchart", - "name": "Bar chart", - "version": "" - }, - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "10.3.3" - }, - { - "type": "datasource", - "id": "grafana-postgresql-datasource", - "name": "PostgreSQL", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "piechart", - "name": "Pie chart", - "version": "" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - } - ], "annotations": { "list": [ { @@ -67,14 +18,15 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": null, + "id": 5, "links": [], "liveNow": false, "panels": [ { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -95,8 +47,7 @@ } ] }, - "unit": "decbytes", - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, @@ -112,6 +63,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -123,17 +75,17 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.3.3", + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT SUM(bytes)\nFROM dpi_stats\nWHERE $__timeFilter(time)\n", + "rawSql": "SELECT sum(bytes) FROM ca_dpi_stats_hourly_bytes WHERE unit_id=$unitid ", "refId": "A", "sql": { "columns": [ @@ -159,8 +111,9 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "description": "", "fieldConfig": { @@ -175,8 +128,7 @@ "viz": false } }, - "mappings": [], - "unitScale": true + "mappings": [] }, "overrides": [] }, @@ -191,8 +143,11 @@ "displayLabels": [], "legend": { "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] }, "pieType": "pie", "reduceOptions": { @@ -212,12 +167,12 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT replace(application, 'netify.', '') as application, SUM(bytes)\nFROM dpi_stats\nWHERE $__timeFilter(time) AND application != ''\nGROUP BY application\n", + "rawSql": "SELECT application, sum(bytes) FROM ca_dpi_stats_hourly_application\nWHERE unit_id=$unitid\nGROUP BY application", "refId": "A", "sql": { "columns": [ @@ -259,8 +214,7 @@ "viz": false } }, - "mappings": [], - "unitScale": true + "mappings": [] }, "overrides": [] }, @@ -370,8 +324,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, @@ -468,8 +421,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [ { @@ -510,7 +462,7 @@ }, "showHeader": true }, - "pluginVersion": "10.3.3", + "pluginVersion": "11.2.0", "targets": [ { "datasource": { @@ -562,8 +514,7 @@ "viz": false } }, - "mappings": [], - "unitScale": true + "mappings": [] }, "overrides": [] }, @@ -826,25 +777,47 @@ "templating": { "list": [ { - "current": {}, + "current": { + "selected": false, + "text": "nethsecurity.nethesis.it (181ff9b0-e2be-4c71-897a-6575e3991a1c)", + "value": "1" + }, "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, - "definition": "select id as __value, uuid as __text from units", + "definition": "SELECT id AS __value, CONCAT(name,' (',uuid,')') AS __text FROM units", "description": "", "hide": 0, "includeAll": false, - "label": "UnitId", + "label": "Unit", "multi": false, "name": "unitid", "options": [], - "query": "select id as __value, uuid as __text from units", + "query": "SELECT id AS __value, CONCAT(name,' (',uuid,')') AS __text FROM units", "refresh": 1, "regex": "", "skipUrlSync": false, "sort": 0, "type": "query" + }, + { + "current": { + "selected": true, + "text": "Local Timescale", + "value": "timescale" + }, + "hide": 2, + "includeAll": false, + "multi": false, + "name": "DS_TIMESCALE", + "options": [], + "query": "grafana-postgresql-datasource", + "queryValue": "", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" } ] }, @@ -856,6 +829,6 @@ "timezone": "", "title": "Network traffic", "uid": "fe0af3cb-9be0-4b2a-8ccb-86704956cf2e", - "version": 23, + "version": 4, "weekStart": "" -} \ No newline at end of file +}