Add restart confirmation from watchdog alerts
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
from datetime import datetime, timezone
|
||||
from typing import Dict
|
||||
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from services.runner import run_cmd
|
||||
|
||||
|
||||
@@ -109,6 +110,21 @@ async def docker_watchdog(container_map, notify, bot, chat_id):
|
||||
state = "error"
|
||||
state = state.strip()
|
||||
if last.get(alias) != state:
|
||||
await notify(bot, chat_id, f"🐳 {alias}: {state}")
|
||||
if state != "running":
|
||||
kb = InlineKeyboardMarkup(
|
||||
inline_keyboard=[[
|
||||
InlineKeyboardButton(
|
||||
text="🔄 Restart",
|
||||
callback_data=f"wdrestart:{alias}"
|
||||
)
|
||||
]]
|
||||
)
|
||||
await bot.send_message(
|
||||
chat_id,
|
||||
f"🐳 {alias}: {state}",
|
||||
reply_markup=kb,
|
||||
)
|
||||
else:
|
||||
await notify(bot, chat_id, f"🐳 {alias}: {state}")
|
||||
last[alias] = state
|
||||
await asyncio.sleep(120)
|
||||
|
||||
Reference in New Issue
Block a user