Keep docker restarts inside docker keyboard

This commit is contained in:
2026-02-09 04:08:27 +03:00
parent f0fb2aad0e
commit 02b8e2bb55

View File

@@ -13,6 +13,7 @@ from keyboards import (
system_logs_integrations_kb, system_logs_integrations_kb,
system_logs_kb, system_logs_kb,
openwrt_kb, openwrt_kb,
docker_kb,
) )
from system_checks import security, disks, hardware, list_disks, smart_last_test from system_checks import security, disks, hardware, list_disks, smart_last_test
from services.http_checks import get_url_checks, check_url from services.http_checks import get_url_checks, check_url
@@ -609,7 +610,7 @@ async def docker_restarts(msg: Message):
rows = read_raw(cfg, hours=hours, limit=5000, include_old=True) rows = read_raw(cfg, hours=hours, limit=5000, include_old=True)
restarts = [(dt, line) for dt, line in rows if "docker_restart" in line] restarts = [(dt, line) for dt, line in rows if "docker_restart" in line]
if not restarts: if not restarts:
await msg.answer(f"🐳 No docker restarts in last {hours}h", reply_markup=system_logs_audit_kb) await msg.answer(f"🐳 No docker restarts in last {hours}h", reply_markup=docker_kb)
return return
counts: dict[str, int] = {} counts: dict[str, int] = {}
for _dt, line in restarts: for _dt, line in restarts:
@@ -623,7 +624,7 @@ async def docker_restarts(msg: Message):
body = "\n".join(f"{dt.astimezone().strftime('%m-%d %H:%M')} {line}" for dt, line in restarts[-50:]) body = "\n".join(f"{dt.astimezone().strftime('%m-%d %H:%M')} {line}" for dt, line in restarts[-50:])
await msg.answer( await msg.answer(
f"🐳 Docker restarts ({hours}h): {len(restarts)} ({top})\n```\n{body}\n```", f"🐳 Docker restarts ({hours}h): {len(restarts)} ({top})\n```\n{body}\n```",
reply_markup=system_logs_audit_kb, reply_markup=docker_kb,
parse_mode="Markdown", parse_mode="Markdown",
) )