From 5794f5a01bc4af75b8eb1ea897a0e3259fbca4b7 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Thu, 18 May 2023 08:48:15 +0300 Subject: [PATCH] Add network bandwidth usage to System table display in System.jsx and update get_bandwidth_stats function in util.py to include go2rtc processes --- frigate/util.py | 4 ++-- web/src/routes/System.jsx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frigate/util.py b/frigate/util.py index f82476ebc..5a2e606b9 100755 --- a/frigate/util.py +++ b/frigate/util.py @@ -864,9 +864,9 @@ def get_bandwidth_stats() -> dict[str, dict]: for line in lines: stats = list(filter(lambda a: a != "", line.strip().split("\t"))) try: - if re.search("^ffmpeg/([0-9]+)/", stats[0]): + if re.search("(^ffmpeg|\/go2rtc)/([0-9]+)/", stats[0]): process = stats[0].split("/") - usages[process[1]] = { + usages[process[len(process)-2]] = { "bandwidth": round(float(stats[2]), 1), } except: diff --git a/web/src/routes/System.jsx b/web/src/routes/System.jsx index 8d5c4ef80..5dc45257a 100644 --- a/web/src/routes/System.jsx +++ b/web/src/routes/System.jsx @@ -428,6 +428,7 @@ export default function System() { CPU % Avg CPU % Memory % + Network Bandwidth @@ -436,6 +437,7 @@ export default function System() { {cpu_usages[processes[process]['pid']]?.['cpu'] || '- '}% {cpu_usages[processes[process]['pid']]?.['cpu_average'] || '- '}% {cpu_usages[processes[process]['pid']]?.['mem'] || '- '}% + {bandwidth_usages[processes[process]['pid']]?.['bandwidth'] || '- '}KB/s