forked from Github/frigate
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:
@@ -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(
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user