secubox-openwrt/package/secubox/secubox-app-watchdog/Makefile
CyberMind-FR 66d9fbc6c0 feat(watchdog): Add service health monitor with auto-recovery
New packages for monitoring and auto-restarting critical services:

secubox-app-watchdog:
- watchdogctl CLI: status, check, check-recover, watch, restart-*
- Monitors LXC containers: haproxy, mitmproxy-in/out, streamlit
- Monitors host services: crowdsec, uhttpd, dnsmasq
- Checks HTTPS endpoints: gk2.secubox.in, admin.gk2, lldh360.maegia.tv
- Auto-recovery with alert cooldown and log rotation
- Procd service + cron fallback for redundancy

luci-app-watchdog:
- Real-time dashboard with 10s polling
- Container/service tables with restart buttons
- Endpoint health indicators
- Alert log viewer with refresh/clear
- RPCD backend: status, restart_*, check, get_logs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-12 06:46:53 +01:00

65 lines
1.6 KiB
Makefile

# SPDX-License-Identifier: MIT
# SecuBox Watchdog - Service Health Monitor & Auto-Recovery
# Copyright (C) 2025-2026 CyberMind.fr
include $(TOPDIR)/rules.mk
PKG_NAME:=secubox-app-watchdog
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk
define Package/secubox-app-watchdog
SECTION:=secubox
CATEGORY:=SecuBox
SUBMENU:=System
TITLE:=SecuBox Service Watchdog
DEPENDS:=+lxc +jsonfilter +curl
PKGARCH:=all
endef
define Package/secubox-app-watchdog/description
Service health monitoring and auto-recovery watchdog.
Features:
- Monitor LXC containers (haproxy, mitmproxy, streamlit)
- Monitor core services (crowdsec, uhttpd, dnsmasq)
- HTTPS endpoint health checks
- Auto-restart failed services
- Alert logging with timestamps
- LuCI dashboard integration
endef
define Package/secubox-app-watchdog/conffiles
/etc/config/watchdog
endef
define Build/Compile
endef
define Package/secubox-app-watchdog/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/watchdog $(1)/etc/config/watchdog
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/watchdog $(1)/etc/init.d/watchdog
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/usr/sbin/watchdogctl $(1)/usr/sbin/watchdogctl
$(INSTALL_DIR) $(1)/etc/cron.d
$(INSTALL_DATA) ./files/etc/cron.d/watchdog $(1)/etc/cron.d/watchdog
endef
define Package/secubox-app-watchdog/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] && exit 0
/etc/init.d/watchdog enable 2>/dev/null || true
exit 0
endef
$(eval $(call BuildPackage,secubox-app-watchdog))