Skip to content

Commit

Permalink
update dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
blesswinsamuel committed Aug 9, 2024
1 parent 380e9e1 commit 863bfd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
18 changes: 9 additions & 9 deletions dashboard/router-monitor-dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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": {
Expand Down
13 changes: 4 additions & 9 deletions dashboard/router-monitor-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
: '')
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 863bfd8

Please sign in to comment.