Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/docs/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion frigate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions frigate/util/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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")
Expand Down