Skip to content

Commit

Permalink
Show other system processes in system page (blakeblackshear#6276)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Apr 28, 2023
1 parent b48f6d7 commit 37360ed
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
9 changes: 8 additions & 1 deletion frigate/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,14 @@ def get_cpu_stats() -> dict[str, dict]:
else:
mem_pct = stats[9]

usages[stats[0]] = {
idx = stats[0]

if stats[-1] == "go2rtc":
idx = "go2rtc"
elif stats[-1] == "frigate.r+":
idx = "recording"

usages[idx] = {
"cpu": stats[8],
"mem": mem_pct,
}
Expand Down
27 changes: 27 additions & 0 deletions web/src/routes/System.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,33 @@ export default function System() {
</div>
)}

<Heading size="lg">Other Processes</Heading>
<div data-testid="cameras" className="grid grid-cols-1 3xl:grid-cols-3 md:grid-cols-2 gap-4">
{['go2rtc', 'recording'].map((process) => (
<div key={process} className="dark:bg-gray-800 shadow-md hover:shadow-lg rounded-lg transition-shadow">
<div className="capitalize text-lg flex justify-between p-4">
<div className="text-lg flex justify-between">{process}</div>
</div>
<div className="p-2">
<Table className="w-full">
<Thead>
<Tr>
<Th>CPU %</Th>
<Th>Memory %</Th>
</Tr>
</Thead>
<Tbody>
<Tr key="ffmpeg" index="0">
<Td>{cpu_usages[process]?.['cpu'] || '- '}%</Td>
<Td>{cpu_usages[process]?.['mem'] || '- '}%</Td>
</Tr>
</Tbody>
</Table>
</div>
</div>
))}
</div>

<p>System stats update automatically every {config.mqtt.stats_interval} seconds.</p>
</Fragment>
)}
Expand Down

0 comments on commit 37360ed

Please sign in to comment.