diff --git a/imageroot/etc/dashboards/network_traffic.json b/imageroot/etc/dashboards/network_traffic.json index c443d8d..4301890 100644 --- a/imageroot/etc/dashboards/network_traffic.json +++ b/imageroot/etc/dashboards/network_traffic.json @@ -1,8 +1,8 @@ { "__inputs": [ { - "name": "DS_GRAFANA-POSTGRESQL-DATASOURCE", - "label": "grafana-postgresql-datasource", + "name": "DS_LOCAL_TIMESCALE", + "label": "Local Timescale", "description": "", "type": "datasource", "pluginId": "grafana-postgresql-datasource", @@ -21,7 +21,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.3.3" + "version": "11.2.0" }, { "type": "datasource", @@ -73,8 +73,9 @@ "panels": [ { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -95,8 +96,7 @@ } ] }, - "unit": "decbytes", - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, @@ -112,6 +112,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -123,17 +124,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_LOCAL_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,65 +160,93 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, - "description": "", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" } }, "mappings": [], - "unitScale": true + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 7, + "w": 18, "x": 6, "y": 0 }, - "id": 11, + "id": 3, "options": { - "displayLabels": [], + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, "legend": { + "calcs": [], "displayMode": "list", - "placement": "bottom", + "placement": "right", "showLegend": true }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "limit": 10, - "values": true - }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", "tooltip": { "mode": "single", "sort": "none" - } + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 }, + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_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 bucket, bytes FROM ca_dpi_stats_hourly_bytes \nWHERE $__timeFilter(bucket) and unit_id =$unitid\nGROUP BY bucket, bytes", "refId": "A", "sql": { "columns": [ @@ -238,13 +267,14 @@ } } ], - "title": "By application", - "type": "piechart" + "title": "Traffic by hour", + "type": "barchart" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "description": "", "fieldConfig": { @@ -260,23 +290,26 @@ } }, "mappings": [], - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 7, - "x": 13, - "y": 0 + "w": 6, + "x": 0, + "y": 8 }, - "id": 4, + "id": 11, "options": { "displayLabels": [], "legend": { "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] }, "pieType": "pie", "reduceOptions": { @@ -296,12 +329,12 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT protocol, SUM(bytes)\nFROM dpi_stats\nWHERE $__timeFilter(time) AND protocol != ''\nGROUP BY protocol\n", + "rawSql": "SELECT replace(application, 'netify.', '') AS application, sum(bytes) FROM ca_dpi_stats_hourly_application\nWHERE unit_id=$unitid\nGROUP BY application", "refId": "A", "sql": { "columns": [ @@ -322,97 +355,74 @@ } } ], - "title": "By protocol", + "title": "By application", "type": "piechart" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, + "description": "", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "fillOpacity": 80, - "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false - }, - "lineWidth": 1, - "scaleDistribution": { - "type": "linear" - }, - "thresholdsStyle": { - "mode": "off" } }, "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes", - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 20, - "x": 0, + "w": 6, + "x": 6, "y": 8 }, - "id": 3, + "id": 12, "options": { - "barRadius": 0, - "barWidth": 0.97, - "fullHighlight": false, - "groupWidth": 0.7, + "displayLabels": [], "legend": { - "calcs": [], "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "limit": 10, + "values": true }, - "orientation": "auto", - "showValue": "auto", - "stacking": "none", "tooltip": { "mode": "single", "sort": "none" - }, - "xTickLabelRotation": 0, - "xTickLabelSpacing": 0 + } }, "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT time_bucket('30m', time) as interval_30_min, SUM(bytes) FROM dpi_stats\nWHERE $__timeFilter(time) AND unit_id=$unitid \nGROUP by interval_30_min", + "rawSql": "SELECT protocol, sum(bytes) as bytes FROM ca_dpi_stats_hourly_protocol\nWHERE unit_id=$unitid\nGROUP BY protocol", "refId": "A", "sql": { "columns": [ @@ -433,94 +443,74 @@ } } ], - "title": "Traffic by hour", - "type": "barchart" + "title": "By protocol", + "type": "piechart" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, + "description": "", "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" }, "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } }, - "links": [], "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "bytes", - "unitScale": true + "unit": "decbytes" }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "client_address" - }, - "properties": [ - { - "id": "links", - "value": [ - { - "title": "", - "url": "/grafana/d/b14a1181-a2ee-4df4-a732-888e0190037f/network-traffic-by-host?${__all_variables}&var-client_address=${__value.raw}" - } - ] - } - ] - } - ] + "overrides": [] }, "gridPos": { "h": 8, - "w": 10, - "x": 0, - "y": 16 + "w": 6, + "x": 12, + "y": 8 }, - "id": 5, + "id": 13, "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" + "displayLabels": [], + "legend": { + "displayMode": "list", + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" ], - "show": true + "fields": "", + "limit": 10, + "values": true }, - "showHeader": true + "tooltip": { + "mode": "single", + "sort": "none" + } }, - "pluginVersion": "10.3.3", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT client_address, client_name, SUM(bytes) as traffic \nFROM dpi_stats\nWHERE $__timeFilter(time) \nGROUP BY client_address, client_name\nORDER by SUM(bytes) desc\nLIMIT 10\n", + "rawSql": "SELECT client_name, sum(bytes) FROM ca_dpi_stats_hourly_client\nWHERE unit_id=$unitid\nGROUP BY client_name", "refId": "A", "sql": { "columns": [ @@ -541,13 +531,14 @@ } } ], - "title": "Top 10 active client", - "type": "table" + "title": "By client", + "type": "piechart" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "description": "", "fieldConfig": { @@ -563,23 +554,26 @@ } }, "mappings": [], - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 7, - "x": 10, - "y": 16 + "w": 6, + "x": 18, + "y": 8 }, - "id": 9, + "id": 14, "options": { "displayLabels": [], "legend": { "displayMode": "list", - "placement": "bottom", - "showLegend": true + "placement": "right", + "showLegend": true, + "values": [ + "value" + ] }, "pieType": "pie", "reduceOptions": { @@ -599,12 +593,12 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT client_name, SUM(bytes)\nFROM dpi_stats\nWHERE $__timeFilter(time) AND unit_id='$unitid'\nGROUP BY client_name\n", + "rawSql": "SELECT host, sum(bytes) FROM ca_dpi_stats_hourly_host\nWHERE unit_id=$unitid\nGROUP BY host", "refId": "A", "sql": { "columns": [ @@ -625,13 +619,14 @@ } } ], - "title": "Traffic by client", + "title": "By host", "type": "piechart" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -651,7 +646,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -659,14 +655,13 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [ { "matcher": { "id": "byName", - "options": "host" + "options": "client_address" }, "properties": [ { @@ -674,7 +669,7 @@ "value": [ { "title": "", - "url": "/grafana/d/c8d43e5f-068e-4cac-9283-2318d9e1911b/network-traffic-by-host?${__all_variables}&var-host=${__value.raw}" + "url": "/grafana/d/b14a1181-a2ee-4df4-a732-888e0190037f/network-traffic-by-host?${__all_variables}&var-client_address=${__value.raw}" } ] } @@ -684,11 +679,11 @@ }, "gridPos": { "h": 8, - "w": 10, + "w": 12, "x": 0, - "y": 24 + "y": 16 }, - "id": 8, + "id": 5, "options": { "cellHeight": "sm", "footer": { @@ -701,17 +696,17 @@ }, "showHeader": true }, - "pluginVersion": "10.3.3", + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT host, SUM(bytes) as traffic \nFROM dpi_stats\nWHERE $__timeFilter(time) AND host != '' and unit_id='$unitid'\nGROUP BY host, client_name\nORDER by SUM(bytes) desc\nLIMIT 10\n", + "rawSql": "SELECT client_address, client_name, bytes FROM ca_dpi_stats_hourly_client\nWHERE $__timeFilter(bucket) AND unit_id=$unitid\nORDER BY bytes DESC\nLIMIT 20", "refId": "A", "sql": { "columns": [ @@ -732,70 +727,94 @@ } } ], - "title": "Top 10 visited hosts", + "title": "Top 20 active clients", "type": "table" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, - "description": "", "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, "custom": { - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - } + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false }, + "links": [], "mappings": [], - "unitScale": true + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "client_address" + }, + "properties": [ + { + "id": "links", + "value": [ + { + "title": "", + "url": "/grafana/d/b14a1181-a2ee-4df4-a732-888e0190037f/network-traffic-by-host?${__all_variables}&var-client_address=${__value.raw}" + } + ] + } + ] + } + ] }, "gridPos": { "h": 8, - "w": 7, - "x": 10, - "y": 24 + "w": 12, + "x": 12, + "y": 16 }, - "id": 10, + "id": 15, "options": { - "displayLabels": [], - "legend": { - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], + "cellHeight": "sm", + "footer": { + "countRows": false, "fields": "", - "limit": 10, - "values": true + "reducer": [ + "sum" + ], + "show": true }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showHeader": true }, + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT host, SUM(bytes)\nFROM dpi_stats\nWHERE $__timeFilter(time) AND host != '' and unit_id='$unitid'\nGROUP BY host\n", + "rawSql": "SELECT host, bytes FROM ca_dpi_stats_hourly_host\nWHERE $__timeFilter(bucket) AND unit_id=$unitid\nORDER BY bytes DESC\nLIMIT 20", "refId": "A", "sql": { "columns": [ @@ -816,35 +835,54 @@ } } ], - "title": "Traffic by host", - "type": "piechart" + "title": "Top 20 contacted hosts", + "type": "table" } ], "refresh": "", "schemaVersion": 39, - "tags": [], + "tags": [ + "unit", + "timescale", + "monitoring", + "traffic" + ], "templating": { "list": [ { "current": {}, "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": {}, + "hide": 2, + "includeAll": false, + "multi": false, + "name": "DS_TIMESCALE", + "options": [], + "query": "grafana-postgresql-datasource", + "queryValue": "", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" } ] }, @@ -856,6 +894,6 @@ "timezone": "", "title": "Network traffic", "uid": "fe0af3cb-9be0-4b2a-8ccb-86704956cf2e", - "version": 23, + "version": 11, "weekStart": "" } \ No newline at end of file diff --git a/imageroot/etc/dashboards/network_traffic_by_client.json b/imageroot/etc/dashboards/network_traffic_by_client.json index ff9a495..e616d27 100644 --- a/imageroot/etc/dashboards/network_traffic_by_client.json +++ b/imageroot/etc/dashboards/network_traffic_by_client.json @@ -1,8 +1,8 @@ { "__inputs": [ { - "name": "DS_GRAFANA-POSTGRESQL-DATASOURCE", - "label": "grafana-postgresql-datasource", + "name": "DS_LOCAL_TIMESCALE", + "label": "Local Timescale", "description": "", "type": "datasource", "pluginId": "grafana-postgresql-datasource", @@ -21,7 +21,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.3.3" + "version": "11.2.0" }, { "type": "datasource", @@ -40,12 +40,6 @@ "id": "table", "name": "Table", "version": "" - }, - { - "type": "panel", - "id": "timeseries", - "name": "Time series", - "version": "" } ], "annotations": { @@ -73,8 +67,9 @@ "panels": [ { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -94,8 +89,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -111,6 +105,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -122,17 +117,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_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT client_name FROM dpi_stats\nWHERE $__timeFilter(time) AND unit_id=$unit_id AND client_address='$client_address'\nLIMIT 1\n", + "rawSql": "SELECT client_name \nFROM ca_dpi_stats_hourly_client\nWHERE $__timeFilter(bucket) AND unit_id = $unitid AND client_address = '$client_address'", "refId": "A", "sql": { "columns": [ @@ -158,8 +153,9 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -172,28 +168,17 @@ "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 20, - "gradientMode": "scheme", + "fillOpacity": 80, + "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, - "insertNulls": false, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, + "lineWidth": 1, "scaleDistribution": { "type": "linear" }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, "thresholdsStyle": { "mode": "off" } @@ -212,40 +197,48 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 9, - "w": 12, + "w": 17, "x": 7, "y": 0 }, "id": 5, "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, "legend": { "calcs": [], - "displayMode": "hidden", - "placement": "right", - "showLegend": false + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, + "orientation": "auto", + "showValue": "auto", + "stacking": "none", "tooltip": { "mode": "single", "sort": "none" - } + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 }, "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT time_bucket('30m', time) as interval_30_min, SUM(bytes) FROM dpi_stats\nWHERE $__timeFilter(time) AND client_address like '$client_address' AND unit_id='$unit_id'\nGROUP by interval_30_min", + "rawSql": "SELECT bucket, bytes \nFROM ca_dpi_stats_hourly_client\nWHERE $__timeFilter(bucket) AND unit_id = $unitid AND client_address = '$client_address'", "refId": "A", "sql": { "columns": [ @@ -267,12 +260,13 @@ } ], "title": "Traffic by hour", - "type": "timeseries" + "type": "barchart" }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -289,8 +283,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, @@ -306,6 +299,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -317,17 +311,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_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT SUM(bytes) FROM dpi_stats WHERE $__timeFilter(time) AND client_address like '$client_address' AND unit_id='$unit_id'", + "rawSql": "SELECT bytes \nFROM ca_dpi_stats_hourly_client\nWHERE $__timeFilter(bucket) AND unit_id = $unitid AND client_address = '$client_address'", "refId": "A", "sql": { "columns": [ @@ -353,13 +347,14 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" }, "custom": { "axisBorderShow": false, @@ -389,17 +384,20 @@ { "color": "green", "value": null + }, + { + "color": "red", + "value": 80 } ] }, - "unit": "bytes", - "unitScale": true + "unit": "short" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 10, + "w": 12, "x": 0, "y": 9 }, @@ -412,11 +410,11 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom", + "placement": "right", "showLegend": true }, - "orientation": "auto", - "showValue": "auto", + "orientation": "horizontal", + "showValue": "never", "stacking": "none", "tooltip": { "mode": "single", @@ -430,12 +428,12 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT application, SUM(bytes) FROM dpi_stats WHERE application!='' AND $__timeFilter(time) AND client_address like '$client_address' AND unit_id='$unit_id' GROUP BY application", + "rawSql": "SELECT application, SUM(bytes) FROM dpi_stats \nWHERE application!='' AND $__timeFilter(time) AND client_address like '$client_address' AND unit_id='$unitid'\nGROUP BY application", "refId": "A", "sql": { "columns": [ @@ -461,13 +459,14 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" }, "custom": { "axisBorderShow": false, @@ -497,21 +496,24 @@ { "color": "green", "value": null + }, + { + "color": "red", + "value": 80 } ] }, - "unit": "bytes", - "unitScale": true + "unit": "short" }, "overrides": [] }, "gridPos": { "h": 8, - "w": 9, - "x": 10, + "w": 12, + "x": 12, "y": 9 }, - "id": 4, + "id": 7, "options": { "barRadius": 0, "barWidth": 0.97, @@ -520,11 +522,11 @@ "legend": { "calcs": [], "displayMode": "list", - "placement": "bottom", + "placement": "right", "showLegend": true }, - "orientation": "auto", - "showValue": "auto", + "orientation": "horizontal", + "showValue": "never", "stacking": "none", "tooltip": { "mode": "single", @@ -538,12 +540,12 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT protocol, SUM(bytes) FROM dpi_stats WHERE protocol!='' AND $__timeFilter(time) AND client_address like '$client_address' AND unit_id='$unit_id' GROUP BY protocol", + "rawSql": "SELECT protocol, SUM(bytes) FROM dpi_stats \nWHERE protocol!='' AND $__timeFilter(time) AND client_address like '$client_address' AND unit_id='$unitid'\nGROUP BY protocol", "refId": "A", "sql": { "columns": [ @@ -569,8 +571,9 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -595,14 +598,13 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 12, - "w": 8, + "w": 12, "x": 0, "y": 17 }, @@ -619,17 +621,17 @@ }, "showHeader": true }, - "pluginVersion": "10.3.3", + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT host, SUM(bytes) as bytes FROM dpi_stats \nWHERE host!='' AND $__timeFilter(time) AND unit_id = '$unit_id' AND client_address like '$client_address'\nGROUP BY host\nORDER BY bytes DESC", + "rawSql": "SELECT host, SUM(bytes) as bytes FROM dpi_stats \nWHERE host!='' AND $__timeFilter(time) AND unit_id = $unitid AND client_address like '$client_address'\nGROUP BY host\nORDER BY bytes DESC", "refId": "A", "sql": { "columns": [ @@ -656,24 +658,31 @@ ], "refresh": "", "schemaVersion": 39, - "tags": [], + "tags": [ + "monitoring", + "traffic", + "unit", + "timescale", + "client", + "details" + ], "templating": { "list": [ { "current": {}, "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": "unit_id", + "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, @@ -698,6 +707,19 @@ "query": "", "skipUrlSync": false, "type": "textbox" + }, + { + "current": {}, + "hide": 2, + "includeAll": false, + "multi": false, + "name": "DS_TIMESCALE", + "options": [], + "query": "grafana-postgresql-datasource", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" } ] }, @@ -709,6 +731,6 @@ "timezone": "", "title": "Network traffic by client", "uid": "b14a1181-a2ee-4df4-a732-888e0190037f", - "version": 18, + "version": 10, "weekStart": "" } \ No newline at end of file diff --git a/imageroot/etc/dashboards/network_traffic_by_host.json b/imageroot/etc/dashboards/network_traffic_by_host.json index d57d64c..a3d6e7f 100644 --- a/imageroot/etc/dashboards/network_traffic_by_host.json +++ b/imageroot/etc/dashboards/network_traffic_by_host.json @@ -1,8 +1,8 @@ { "__inputs": [ { - "name": "DS_GRAFANA-POSTGRESQL-DATASOURCE", - "label": "grafana-postgresql-datasource", + "name": "DS_LOCAL_TIMESCALE", + "label": "Local Timescale", "description": "", "type": "datasource", "pluginId": "grafana-postgresql-datasource", @@ -21,7 +21,7 @@ "type": "grafana", "id": "grafana", "name": "Grafana", - "version": "10.3.3" + "version": "11.2.0" }, { "type": "datasource", @@ -67,8 +67,9 @@ "panels": [ { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -85,8 +86,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, @@ -102,6 +102,7 @@ "graphMode": "area", "justifyMode": "auto", "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "lastNotNull" @@ -113,17 +114,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_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT SUM(bytes) FROM dpi_stats WHERE $__timeFilter(time) AND host='$host' AND unit_id='$unit_id'", + "rawSql": "SELECT bytes FROM ca_dpi_stats_hourly_host\nWHERE $__timeFilter(bucket) AND unit_id = $unitid AND host like '$host'", "refId": "A", "sql": { "columns": [ @@ -149,13 +150,14 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, "custom": { "axisBorderShow": false, @@ -192,8 +194,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, @@ -225,16 +226,17 @@ "xTickLabelRotation": 0, "xTickLabelSpacing": 0 }, + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT time_bucket('30m', time) as interval_30_min, SUM(bytes) FROM dpi_stats\nWHERE $__timeFilter(time) AND host='$host' AND unit_id='$unit_id'\nGROUP by interval_30_min", + "rawSql": "SELECT bucket, sum(bytes) as bytes FROM ca_dpi_stats_hourly_host\nWHERE $__timeFilter(bucket) AND unit_id = $unitid AND host like '$host'\nGROUP BY bucket, bytes\nORDER BY bucket", "refId": "A", "sql": { "columns": [ @@ -260,8 +262,9 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -303,8 +306,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, @@ -341,12 +343,12 @@ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT\n time_bucket('30m', time) AS time,\n client_address as client,\n SUM(bytes) AS value\nFROM dpi_stats\nWHERE $__timeFilter(time) AND host='$host' AND unit_id='$unit_id'\nGROUP BY time, client\nORDER BY time", + "rawSql": "SELECT\n time_bucket('30m', time) AS time,\n client_address as client,\n SUM(bytes) AS value\nFROM dpi_stats\nWHERE $__timeFilter(time) AND host LIKE '$host' AND unit_id='$unitid'\nGROUP BY time, client\nORDER BY time", "refId": "A", "sql": { "columns": [ @@ -385,8 +387,9 @@ }, { "datasource": { + "default": false, "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_TIMESCALE}" }, "fieldConfig": { "defaults": { @@ -411,8 +414,7 @@ } ] }, - "unit": "bytes", - "unitScale": true + "unit": "bytes" }, "overrides": [] }, @@ -435,17 +437,17 @@ }, "showHeader": true }, - "pluginVersion": "10.3.3", + "pluginVersion": "11.2.0", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", - "uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}" + "uid": "${DS_LOCAL_TIMESCALE}" }, "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "SELECT client_address, client_name, SUM(bytes) as bytes FROM dpi_stats \nWHERE $__timeFilter(time) AND unit_id = '$unit_id' AND host='$host'\nGROUP BY client_address, client_name\nORDER BY bytes DESC", + "rawSql": "SELECT client_address, client_name, SUM(bytes) as bytes FROM dpi_stats \nWHERE $__timeFilter(time) AND unit_id = '$unitid' AND host LIKE '$host'\nGROUP BY client_address, client_name\nORDER BY bytes DESC", "refId": "A", "sql": { "columns": [ @@ -472,22 +474,28 @@ ], "refresh": "", "schemaVersion": 39, - "tags": [], + "tags": [ + "monitoring", + "timescale", + "traffic", + "host" + ], "templating": { "list": [ { "current": {}, "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", "hide": 0, "includeAll": false, + "label": "Unit", "multi": false, - "name": "unit_id", + "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, @@ -503,9 +511,22 @@ "hide": 0, "name": "host", "options": [], - "query": "pod-031-2010-09.backblaze.com", + "query": "", "skipUrlSync": false, "type": "textbox" + }, + { + "current": {}, + "hide": 2, + "includeAll": false, + "multi": false, + "name": "DS_TIMESCALE", + "options": [], + "query": "grafana-postgresql-datasource", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" } ] }, @@ -517,6 +538,6 @@ "timezone": "", "title": "Network traffic by host", "uid": "c8d43e5f-068e-4cac-9283-2318d9e1911b", - "version": 7, + "version": 9, "weekStart": "" } \ No newline at end of file