diff --git a/logging/grafana-dashboards/tailscale-proxy.json b/logging/grafana-dashboards/tailscale-proxy.json index 93404f1..fb0c97b 100644 --- a/logging/grafana-dashboards/tailscale-proxy.json +++ b/logging/grafana-dashboards/tailscale-proxy.json @@ -7,7 +7,7 @@ "loki" ], "schemaVersion": 39, - "version": 1, + "version": 2, "editable": true, "refresh": "30s", "time": { @@ -36,6 +36,19 @@ "panels": [ { "id": 1, + "type": "row", + "title": "HTTP-прокси (:3128) — tinyproxy", + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "panels": [] + }, + { + "id": 2, "type": "stat", "title": "Всего запросов", "datasource": { @@ -46,7 +59,7 @@ "h": 4, "w": 8, "x": 0, - "y": 0 + "y": 1 }, "options": { "reduceOptions": { @@ -85,7 +98,7 @@ ] }, { - "id": 2, + "id": 3, "type": "stat", "title": "Уникальных клиентов", "datasource": { @@ -96,7 +109,7 @@ "h": 4, "w": 8, "x": 8, - "y": 0 + "y": 1 }, "options": { "reduceOptions": { @@ -135,7 +148,7 @@ ] }, { - "id": 3, + "id": 4, "type": "stat", "title": "Уникальных назначений", "datasource": { @@ -146,7 +159,7 @@ "h": 4, "w": 8, "x": 16, - "y": 0 + "y": 1 }, "options": { "reduceOptions": { @@ -185,7 +198,7 @@ ] }, { - "id": 4, + "id": 5, "type": "timeseries", "title": "Запросы по методам", "datasource": { @@ -196,7 +209,7 @@ "h": 8, "w": 24, "x": 0, - "y": 4 + "y": 5 }, "fieldConfig": { "defaults": { @@ -238,7 +251,7 @@ ] }, { - "id": 5, + "id": 6, "type": "table", "title": "Топ назначений", "datasource": { @@ -249,7 +262,7 @@ "h": 9, "w": 12, "x": 0, - "y": 12 + "y": 13 }, "options": { "showHeader": true, @@ -302,7 +315,7 @@ ] }, { - "id": 6, + "id": 7, "type": "table", "title": "Топ клиентов", "datasource": { @@ -313,7 +326,7 @@ "h": 9, "w": 12, "x": 12, - "y": 12 + "y": 13 }, "options": { "showHeader": true, @@ -366,18 +379,18 @@ ] }, { - "id": 7, + "id": 8, "type": "logs", - "title": "Журнал доступа (live)", + "title": "Журнал доступа HTTP (live)", "datasource": { "type": "loki", "uid": "${datasource}" }, "gridPos": { - "h": 10, + "h": 9, "w": 24, "x": 0, - "y": 21 + "y": 22 }, "options": { "showTime": true, @@ -398,6 +411,437 @@ "refId": "A" } ] + }, + { + "id": 9, + "type": "row", + "title": "SOCKS5-прокси (:1080) — 3proxy", + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 31 + }, + "panels": [] + }, + { + "id": 10, + "type": "stat", + "title": "Всего соединений", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 8, + "x": 0, + "y": 32 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "none", + "textMode": "auto", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "fixed", + "fixedColor": "purple" + }, + "unit": "short" + }, + "overrides": [] + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "sum(count_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" [$__range]))", + "refId": "A", + "queryType": "instant" + } + ] + }, + { + "id": 11, + "type": "stat", + "title": "Уникальных клиентов", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 8, + "x": 8, + "y": 32 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "none", + "textMode": "auto", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "fixed", + "fixedColor": "purple" + }, + "unit": "short" + }, + "overrides": [] + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "count(sum by (clientip)(count_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" | pattern \" : <_>\" [$__range])))", + "refId": "A", + "queryType": "instant" + } + ] + }, + { + "id": 12, + "type": "stat", + "title": "Уникальных назначений", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 4, + "w": 8, + "x": 16, + "y": 32 + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "none", + "textMode": "auto", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "fixed", + "fixedColor": "purple" + }, + "unit": "short" + }, + "overrides": [] + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "count(sum by (dest)(count_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" | pattern \"<_> CONNECT \" | dest != \"0.0.0.0:0\" [$__range])))", + "refId": "A", + "queryType": "instant" + } + ] + }, + { + "id": 13, + "type": "timeseries", + "title": "Соединения во времени", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 36 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "fillOpacity": 15, + "stacking": { + "mode": "none", + "group": "A" + } + }, + "unit": "cps" + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "sum(count_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" [$__auto]))", + "refId": "A", + "queryType": "range", + "legendFormat": "соединения" + } + ] + }, + { + "id": 14, + "type": "timeseries", + "title": "Трафик клиенту (байт/интервал)", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 36 + }, + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "line", + "fillOpacity": 15, + "stacking": { + "mode": "none", + "group": "A" + } + }, + "unit": "bytes" + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "sum(sum_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" | pattern \" <_>\" | unwrap bout [$__auto]))", + "refId": "A", + "queryType": "range", + "legendFormat": "байт" + } + ] + }, + { + "id": 15, + "type": "table", + "title": "Топ назначений", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 44 + }, + "options": { + "showHeader": true, + "sortBy": [ + { + "displayName": "соединений", + "desc": true + } + ] + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "filterable": true + } + }, + "overrides": [] + }, + "transformations": [ + { + "id": "labelsToFields", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true + }, + "renameByName": { + "dest": "dest", + "Value #A": "соединений", + "Value": "соединений" + } + } + } + ], + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "topk(15, sum by (dest)(count_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" | pattern \"<_> CONNECT \" | dest != \"0.0.0.0:0\" [$__range])))", + "refId": "A", + "queryType": "instant" + } + ] + }, + { + "id": 16, + "type": "table", + "title": "Топ клиентов", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 44 + }, + "options": { + "showHeader": true, + "sortBy": [ + { + "displayName": "соединений", + "desc": true + } + ] + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "filterable": true + } + }, + "overrides": [] + }, + "transformations": [ + { + "id": "labelsToFields", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true + }, + "renameByName": { + "clientip": "clientip", + "Value #A": "соединений", + "Value": "соединений" + } + } + } + ], + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "topk(15, sum by (clientip)(count_over_time({source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \" | pattern \" : <_>\" [$__range])))", + "refId": "A", + "queryType": "instant" + } + ] + }, + { + "id": 17, + "type": "logs", + "title": "Журнал доступа SOCKS5 (live)", + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 53 + }, + "options": { + "showTime": true, + "wrapLogMessage": false, + "enableLogDetails": true, + "dedupStrategy": "none", + "sortOrder": "Descending" + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${datasource}" + }, + "editorMode": "code", + "expr": "{source_ip=\"192.168.0.35\"} |~ \" 1080 [0-9]{5} \"", + "queryType": "range", + "refId": "A" + } + ] } ] } \ No newline at end of file