From 816ebda30b3e579aa96cdead2a184cdd99b65734 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 14 Sep 2023 15:01:11 -0600 Subject: [PATCH 1/6] add note about network bandwidth permissions --- docs/docs/configuration/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 4442b3b572..5449e62342 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -639,6 +639,7 @@ telemetry: # Enable Intel GPU stats (default: shown below) intel_gpu_stats: True # Enable network bandwidth stats monitoring for camera ffmpeg processes, go2rtc, and object detectors. (default: shown below) + # NOTE: The container must either be privileged or have cap_net_admin, cap_net_raw capabilities enabled. network_bandwidth: False # Optional: Enable the latest version outbound check (default: shown below) # NOTE: If you use the HomeAssistant integration, disabling this will prevent it from reporting new versions From 94b120d8fd5c5fe068b8611dd3ab66b130062d1c Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 14 Sep 2023 15:31:55 -0600 Subject: [PATCH 2/6] Update default net int --- docs/docs/configuration/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 5449e62342..9ed495a212 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -624,7 +624,7 @@ ui: # Optional: Telemetry configuration telemetry: - # Optional: Enabled network interfaces for bandwidth stats monitoring (default: shown below) + # Optional: Enabled network interfaces for bandwidth stats monitoring (default: empty list, let nethogs search all) network_interfaces: - eth - enp From b4393028bafbb04abad589f0d36225e48316f364 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 14 Sep 2023 15:32:46 -0600 Subject: [PATCH 3/6] Set default network interfaces to empty --- frigate/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frigate/config.py b/frigate/config.py index f98da38552..9d2fda0d14 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -107,7 +107,7 @@ class StatsConfig(FrigateBaseModel): class TelemetryConfig(FrigateBaseModel): network_interfaces: List[str] = Field( - default=["eth", "enp", "eno", "ens", "wl", "lo"], + default=[], title="Enabled network interfaces for bandwidth calculation.", ) stats: StatsConfig = Field( From 050a9ebf1bf815ee9f59850d49d48316c5fdceb1 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 14 Sep 2023 15:33:35 -0600 Subject: [PATCH 4/6] Don't read interfaces if none are set --- frigate/util/services.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frigate/util/services.py b/frigate/util/services.py index 0d5de327dc..6ffb6ea29c 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -143,6 +143,9 @@ def get_cpu_stats() -> dict[str, dict]: def get_physical_interfaces(interfaces) -> list: + if not interfaces: + return [] + with open("/proc/net/dev", "r") as file: lines = file.readlines() From cf0e3e51d83e02217d510b627ca2edee2d0116b3 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 14 Sep 2023 15:54:37 -0600 Subject: [PATCH 5/6] Formatting --- frigate/util/services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frigate/util/services.py b/frigate/util/services.py index 6ffb6ea29c..f85f11b706 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -145,7 +145,7 @@ def get_cpu_stats() -> dict[str, dict]: def get_physical_interfaces(interfaces) -> list: if not interfaces: return [] - + with open("/proc/net/dev", "r") as file: lines = file.readlines() From f09528a7790b5d4fc4aaa75092c41cdc8fc40167 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 14 Sep 2023 16:34:03 -0600 Subject: [PATCH 6/6] Add stderr output --- frigate/util/services.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frigate/util/services.py b/frigate/util/services.py index f85f11b706..2ffddcacfd 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -174,6 +174,7 @@ def get_bandwidth_stats(config) -> dict[str, dict]: ) if p.returncode != 0: + logger.error(f"Error getting network stats :: {p.stderr}") return usages else: lines = p.stdout.split("\n")