ram and cpu monitoring

This commit is contained in:
Alex 2024-07-27 18:10:40 +03:00
parent 5bbcf95015
commit 4fd3391c70
5 changed files with 93 additions and 8 deletions

View file

@ -39,7 +39,11 @@ async def checker(check: Callable | Coroutine, interval_secs: int, client: nio.A
async def main():
signal.signal(signal.SIGTERM, stop_gracefully)
client = await alerts.get_client()
checkers = (checker(checks.temp_check, 5 * 60, client),)
checkers = (
checker(checks.temp_check, 5 * 60, client),
checker(checks.cpu_check, 5 * 60, client),
checker(checks.ram_check, 1 * 60, client),
)
async with asyncio.TaskGroup() as tg:
checker_tasks: set[asyncio.Task] = set()
for c in checkers: