diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 1644903a1..980d14465 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -568,6 +568,14 @@ telemetry: - ens - wl - lo + # Optional: Configure system stats + stats: + # Enable AMD GPU stats (default: shown below) + amd_gpu_stats: True + # 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) + 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 version_check: True diff --git a/frigate/config.py b/frigate/config.py index 58545e27c..156a755c5 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -89,11 +89,22 @@ class UIConfig(FrigateBaseModel): ) +class StatsConfig(FrigateBaseModel): + amd_gpu_stats: bool = Field(default=True, title="Enable AMD GPU stats.") + intel_gpu_stats: bool = Field(default=True, title="Enable Intel GPU stats.") + network_bandwidth: bool = Field( + default=False, title="Enable network bandwidth for ffmpeg processes." + ) + + class TelemetryConfig(FrigateBaseModel): network_interfaces: List[str] = Field( default=["eth", "enp", "eno", "ens", "wl", "lo"], title="Enabled network interfaces for bandwidth calculation.", ) + stats: StatsConfig = Field( + default_factory=StatsConfig, title="System Stats Configuration" + ) version_check: bool = Field(default=True, title="Enable latest version check.") diff --git a/frigate/stats.py b/frigate/stats.py index dd8c4b06d..246f74bf1 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -104,13 +104,15 @@ def get_processing_stats( """Get stats for cpu / gpu.""" async def run_tasks() -> None: - await asyncio.wait( - [ - asyncio.create_task(set_gpu_stats(config, stats, hwaccel_errors)), - asyncio.create_task(set_cpu_stats(stats)), - asyncio.create_task(set_bandwidth_stats(config, stats)), - ] - ) + stats_tasks = [ + asyncio.create_task(set_gpu_stats(config, stats, hwaccel_errors)), + asyncio.create_task(set_cpu_stats(stats)), + ] + + if config.telemetry.stats.network_bandwidth: + stats_tasks.append(asyncio.create_task(set_bandwidth_stats(config, stats))) + + await asyncio.wait(stats_tasks) loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) @@ -179,6 +181,9 @@ async def set_gpu_stats( stats["nvidia-gpu"] = {"gpu": -1, "mem": -1} hwaccel_errors.append(args) elif "qsv" in args: + if not config.telemetry.stats.intel_gpu_stats: + continue + # intel QSV GPU intel_usage = get_intel_gpu_stats() @@ -191,6 +196,9 @@ async def set_gpu_stats( driver = os.environ.get(DRIVER_ENV_VAR) if driver == DRIVER_AMD: + if not config.telemetry.stats.amd_gpu_stats: + continue + # AMD VAAPI GPU amd_usage = get_amd_gpu_stats() @@ -200,6 +208,9 @@ async def set_gpu_stats( stats["amd-vaapi"] = {"gpu": -1, "mem": -1} hwaccel_errors.append(args) else: + if not config.telemetry.stats.intel_gpu_stats: + continue + # intel VAAPI GPU intel_usage = get_intel_gpu_stats() diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index bf4c57c45..82c8d619d 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -96,7 +96,8 @@ export default function System() { System {service.version} {config && ( - go2rtc {go2rtc && ( `${go2rtc.version} ` ) } + + go2rtc {go2rtc && `${go2rtc.version} `} Inference Speed