Add acknowledged alert history and HTML email digests

This commit is contained in:
Maxim
2026-08-01 11:00:16 +03:00
parent 9e907f8455
commit 5491be2e0c
7 changed files with 280 additions and 13 deletions

View File

@@ -97,6 +97,13 @@ func openStore(path string) (*Store, error) {
zfs_usage REAL NOT NULL, guests_cpu REAL NOT NULL, guests_memory REAL NOT NULL
)`,
`CREATE INDEX IF NOT EXISTS history_ts_idx ON history(ts)`,
`CREATE TABLE IF NOT EXISTS alert_events (
id INTEGER PRIMARY KEY AUTOINCREMENT, alert_key TEXT NOT NULL, severity TEXT NOT NULL,
source TEXT NOT NULL, title TEXT NOT NULL, message TEXT NOT NULL,
first_seen INTEGER NOT NULL, last_seen INTEGER NOT NULL, resolved_at INTEGER,
acknowledged_at INTEGER, email_sent_at INTEGER
)`,
`CREATE INDEX IF NOT EXISTS alert_events_active_idx ON alert_events(alert_key,resolved_at)`,
}
for _, statement := range statements {
if _, err := db.Exec(statement); err != nil {