feat: add systemd watchdog, OOM detection, disk growth alerting

MEM-01: OOM kill detection via dmesg checks every 5 minutes
MEM-03: Disk growth rate tracking (288 samples over 24h), warns at >1GB/day
MEM-04: Systemd watchdog (WatchdogSec=60, sd_notify::Watchdog every 30s)
        Service Type=notify for proper startup notification

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-14 02:54:59 +00:00
co-authored by Claude Opus 4.6
parent 65fde5c965
commit d2f5e68bb3
5 changed files with 87 additions and 5 deletions
+12
View File
@@ -122,6 +122,18 @@ async fn main() -> Result<()> {
info!("RPC API: http://{}/rpc/v1", addr);
info!("WebSocket: ws://{}/ws", addr);
// Notify systemd that we're ready (Type=notify)
let _ = sd_notify::notify(true, &[sd_notify::NotifyState::Ready]);
// Spawn systemd watchdog ping (WatchdogSec=60, ping every 30s)
tokio::spawn(async {
let mut interval = tokio::time::interval(std::time::Duration::from_secs(30));
loop {
interval.tick().await;
let _ = sd_notify::notify(false, &[sd_notify::NotifyState::Watchdog]);
}
});
// Graceful shutdown: wait for SIGTERM or SIGINT
let shutdown = async {
let mut sigterm = signal::unix::signal(signal::unix::SignalKind::terminate())