add note about network bandwidth permissions and don't set interfaces by default (#7813)

* add note about network bandwidth permissions

* Update default net int

* Set default network interfaces to empty

* Don't read interfaces if none are set

* Formatting

* Add stderr output
This commit is contained in:
Nicolas Mowen
2023-09-21 04:26:22 -06:00
committed by GitHub
parent a3eccce8f3
commit fd9196ae3e
3 changed files with 7 additions and 2 deletions

View File

@@ -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(

View File

@@ -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()
@@ -171,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")