{ "uid": "openvpn-clients", "title": "OpenVPN — клиенты", "tags": ["openvpn", "vpn", "infra"], "timezone": "browser", "schemaVersion": 39, "version": 1, "refresh": "30s", "time": { "from": "now-24h", "to": "now" }, "templating": { "list": [ { "name": "instance", "type": "query", "datasource": { "type": "prometheus", "uid": "prometheus" }, "query": { "query": "label_values(openvpn_up, instance)", "refId": "v" }, "refresh": 2, "includeAll": true, "multi": true, "current": { "text": "All", "value": "$__all" } } ] }, "panels": [ { "type": "stat", "title": "Клиентов онлайн", "gridPos": { "h": 4, "w": 8, "x": 0, "y": 0 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "short", "color": { "mode": "fixed", "fixedColor": "green" } } }, "targets": [ { "expr": "sum(openvpn_openvpn_server_connected_clients{instance=~\"$instance\"})", "refId": "A" } ] }, { "type": "stat", "title": "Скачано клиентами (за период)", "gridPos": { "h": 4, "w": 8, "x": 8, "y": 0 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "bytes", "color": { "mode": "fixed", "fixedColor": "blue" } } }, "options": { "graphMode": "area" }, "targets": [ { "expr": "sum(increase(openvpn_server_client_sent_bytes_total{instance=~\"$instance\"}[$__range]))", "refId": "A" } ] }, { "type": "stat", "title": "Загружено клиентами (за период)", "gridPos": { "h": 4, "w": 8, "x": 16, "y": 0 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "bytes", "color": { "mode": "fixed", "fixedColor": "purple" } } }, "options": { "graphMode": "area" }, "targets": [ { "expr": "sum(increase(openvpn_server_client_received_bytes_total{instance=~\"$instance\"}[$__range]))", "refId": "A" } ] }, { "type": "table", "title": "Активные клиенты (кто / откуда / VPN-IP / когда подключился)", "gridPos": { "h": 8, "w": 24, "x": 0, "y": 4 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "targets": [ { "expr": "openvpn_server_client_received_bytes_total{instance=~\"$instance\"}", "refId": "A", "instant": true, "format": "table" } ], "transformations": [ { "id": "organize", "options": { "excludeByName": { "Time": true, "__name__": true, "job": true, "username": true, "Value": true }, "renameByName": { "common_name": "Клиент", "instance": "Сервер (нода)", "real_address": "Откуда (real IP)", "virtual_address": "VPN IP", "status_path": "Профиль", "connection_time": "Подключён (unix)" } } } ], "fieldConfig": { "defaults": {}, "overrides": [] } }, { "type": "timeseries", "title": "Download по клиентам (сервер → клиент), бит/с", "gridPos": { "h": 8, "w": 12, "x": 0, "y": 12 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "bps", "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 10 } } }, "targets": [ { "expr": "rate(openvpn_server_client_sent_bytes_total{instance=~\"$instance\"}[$__rate_interval])*8", "legendFormat": "{{common_name}}", "refId": "A" } ] }, { "type": "timeseries", "title": "Upload по клиентам (клиент → сервер), бит/с", "gridPos": { "h": 8, "w": 12, "x": 12, "y": 12 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "bps", "custom": { "drawStyle": "line", "lineWidth": 2, "fillOpacity": 10 } } }, "targets": [ { "expr": "rate(openvpn_server_client_received_bytes_total{instance=~\"$instance\"}[$__rate_interval])*8", "legendFormat": "{{common_name}}", "refId": "A" } ] }, { "type": "bargauge", "title": "Трафик по клиентам за период (download + upload)", "gridPos": { "h": 7, "w": 24, "x": 0, "y": 20 }, "datasource": { "type": "prometheus", "uid": "prometheus" }, "fieldConfig": { "defaults": { "unit": "bytes" } }, "options": { "displayMode": "gradient", "orientation": "horizontal" }, "targets": [ { "expr": "sum by (common_name) (increase(openvpn_server_client_sent_bytes_total{instance=~\"$instance\"}[$__range]) + increase(openvpn_server_client_received_bytes_total{instance=~\"$instance\"}[$__range]))", "legendFormat": "{{common_name}}", "refId": "A", "instant": true } ] } ] }