diff --git a/dashboard/router-monitor-dashboard.json b/dashboard/router-monitor-dashboard.json index aafe477..f0f2b66 100644 --- a/dashboard/router-monitor-dashboard.json +++ b/dashboard/router-monitor-dashboard.json @@ -688,7 +688,7 @@ "targets": [ { "editorMode": "code", - "expr": "last_over_time(sum by (ip_addr, hw_addr, device) (router_monitor_arp_devices{instance=~\"$instance\"})[$__range]) * on(ip_addr) group_left(hostname) last_over_time(sum by (ip_addr, hostname) (router_monitor_hostnames{instance=~\"$instance\"})[$__range])", + "expr": "sum by (ip_addr, hw_addr, hostname, device) (router_monitor_arp_devices{instance=~\"$instance\"})", "range": false, "instant": true, "format": "table", @@ -977,7 +977,7 @@ "targets": [ { "editorMode": "code", - "expr": "\nlabel_replace(\n sum by(dst) (\n increase(\n router_monitor_bytes_total{dst=~\"$localips\",src=~\"internet\",instance=~\"$instance\"}[$__range]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"dst\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) (keep_last_value(\n sum by (ip_addr, hw_addr, device, hostname) (\n router_monitor_arp_devices{instance=~\"$instance\"} \n * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~\"$instance\"}\n )\n ) * 0 + 1)\n", + "expr": "\nlabel_replace(\n sum by(dst) (\n increase(\n router_monitor_bytes_total{dst=~\"$localips\",src=~\"internet\",instance=~\"$instance\"}[$__range]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"dst\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) (keep_last_value(\n sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~\"$instance\"})\n ) * 0 + 1)\n", "legendFormat": "{{ hostname }} ({{ ip_addr }})", "range": false, "instant": true, @@ -1038,7 +1038,7 @@ "targets": [ { "editorMode": "code", - "expr": "\nlabel_replace(\n sum by(src) (\n increase(\n router_monitor_bytes_total{src=~\"$localips\",dst=~\"internet\",instance=~\"$instance\"}[$__range]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"src\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) (keep_last_value(\n sum by (ip_addr, hw_addr, device, hostname) (\n router_monitor_arp_devices{instance=~\"$instance\"} \n * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~\"$instance\"}\n )\n ) * 0 + 1)\n", + "expr": "\nlabel_replace(\n sum by(src) (\n increase(\n router_monitor_bytes_total{src=~\"$localips\",dst=~\"internet\",instance=~\"$instance\"}[$__range]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"src\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) (keep_last_value(\n sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~\"$instance\"})\n ) * 0 + 1)\n", "legendFormat": "{{ hostname }} ({{ ip_addr }})", "range": false, "instant": true, @@ -1099,7 +1099,7 @@ "targets": [ { "editorMode": "code", - "expr": "\nlabel_replace(\n sum by(dst) (\n increase(\n router_monitor_bytes_total{dst=~\"$localips\",src=~\"internet\",instance=~\"$instance\"}[$__interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"dst\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (\n router_monitor_arp_devices{instance=~\"$instance\"} \n * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~\"$instance\"}\n )\n ) * 0 + 1)\n", + "expr": "\nlabel_replace(\n sum by(dst) (\n increase(\n router_monitor_bytes_total{dst=~\"$localips\",src=~\"internet\",instance=~\"$instance\"}[$__interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"dst\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~\"$instance\"})\n ) * 0 + 1)\n", "legendFormat": "{{ hostname }} ({{ ip_addr }})", "range": true, "instant": false, @@ -1192,7 +1192,7 @@ "targets": [ { "editorMode": "code", - "expr": "\nlabel_replace(\n sum by(src) (\n increase(\n router_monitor_bytes_total{src=~\"$localips\",dst=~\"internet\",instance=~\"$instance\"}[$__interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"src\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (\n router_monitor_arp_devices{instance=~\"$instance\"} \n * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~\"$instance\"}\n )\n ) * 0 + 1)\n", + "expr": "\nlabel_replace(\n sum by(src) (\n increase(\n router_monitor_bytes_total{src=~\"$localips\",dst=~\"internet\",instance=~\"$instance\"}[$__interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"src\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~\"$instance\"})\n ) * 0 + 1)\n", "legendFormat": "{{ hostname }} ({{ ip_addr }})", "range": true, "instant": false, @@ -1285,7 +1285,7 @@ "targets": [ { "editorMode": "code", - "expr": "\nlabel_replace(\n sum by(dst) (\n rate(\n router_monitor_bytes_total{dst=~\"$localips\",src=~\"internet\",instance=~\"$instance\"}[$__rate_interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"dst\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (\n router_monitor_arp_devices{instance=~\"$instance\"} \n * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~\"$instance\"}\n )\n ) * 0 + 1)\n", + "expr": "\nlabel_replace(\n sum by(dst) (\n rate(\n router_monitor_bytes_total{dst=~\"$localips\",src=~\"internet\",instance=~\"$instance\"}[$__rate_interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"dst\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~\"$instance\"})\n ) * 0 + 1)\n", "legendFormat": "{{ hostname }} ({{ ip_addr }})", "range": true, "instant": false, @@ -1380,7 +1380,7 @@ "targets": [ { "editorMode": "code", - "expr": "\nlabel_replace(\n sum by(src) (\n rate(\n router_monitor_bytes_total{src=~\"$localips\",dst=~\"internet\",instance=~\"$instance\"}[$__rate_interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"src\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (\n router_monitor_arp_devices{instance=~\"$instance\"} \n * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~\"$instance\"}\n )\n ) * 0 + 1)\n", + "expr": "\nlabel_replace(\n sum by(src) (\n rate(\n router_monitor_bytes_total{src=~\"$localips\",dst=~\"internet\",instance=~\"$instance\"}[$__rate_interval]\n ) > 0\n ),\n \"ip_addr\", \"$1\", \"src\", \"(.*)\"\n)\n* on(ip_addr) group_left(hw_addr, device, hostname) ((\n sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~\"$instance\"})\n ) * 0 + 1)\n", "legendFormat": "{{ hostname }} ({{ ip_addr }})", "range": true, "instant": false, @@ -1850,12 +1850,12 @@ "router-monitor" ], "timezone": "browser", - "description": "Dashboard for EBPF Firewall", + "description": "Dashboard for Router Monitor", "time": { "from": "now-24h", "to": "now" }, - "title": "EBPF Firewall", + "title": "Router Monitor", "uid": "router-monitor", "version": 1, "templating": { diff --git a/dashboard/router-monitor-dashboard.ts b/dashboard/router-monitor-dashboard.ts index 979920e..992f02f 100644 --- a/dashboard/router-monitor-dashboard.ts +++ b/dashboard/router-monitor-dashboard.ts @@ -35,10 +35,7 @@ label_replace( (extraFields ? ` * on(ip_addr) group_left(hw_addr, device, hostname) (${queryType === '$__range' ? 'keep_last_value' : ''}( - sum by (ip_addr, hw_addr, device, hostname) ( - router_monitor_arp_devices{instance=~"$instance"} - * on (ip_addr) group_left (hostname) router_monitor_hostnames{instance=~"$instance"} - ) + sum by (ip_addr, hw_addr, device, hostname) (router_monitor_arp_devices{instance=~"$instance"}) ) * 0 + 1) ` // hack: $__range is used only in pie chart, which is an instant query : '') @@ -256,9 +253,7 @@ const panels: PanelRowAndGroups = [ title: 'Connected Devices', targets: [ { - expr: - 'last_over_time(sum by (ip_addr, hw_addr, device) (router_monitor_arp_devices{instance=~"$instance"})[$__range]) ' + - '* on(ip_addr) group_left(hostname) last_over_time(sum by (ip_addr, hostname) (router_monitor_hostnames{instance=~"$instance"})[$__range])', + expr: 'sum by (ip_addr, hw_addr, hostname, device) (router_monitor_arp_devices{instance=~"$instance"})', // expr: 'sum by (ip_addr, hw_addr, device) (last_over_time(router_monitor_arp_devices{instance=~"$instance"}[$__range])) * on(ip_addr) group_left(hostname) max by (ip_addr, hostname) (last_over_time(router_monitor_hostnames{instance=~"$instance"}[$__range]))', format: 'table', type: 'instant', @@ -364,14 +359,14 @@ const panels: PanelRowAndGroups = [ const dashboard: Dashboard = { ...defaultDashboard, - description: 'Dashboard for EBPF Firewall', + description: 'Dashboard for Router Monitor', graphTooltip: DashboardCursorSync.Crosshair, tags: ['router-monitor'], time: { from: 'now-24h', to: 'now', }, - title: 'EBPF Firewall', + title: 'Router Monitor', uid: 'router-monitor', version: 1, panels: autoLayout(panels),