mirror of
https://github.com/Dvorinka/beszel.git
synced 2026-06-03 21:02:56 +00:00
Add public monitoring features and CI updates
- Add status pages, incidents, badges, maintenance, bulk ops, and metrics - Add Docker packaging, env example, and frontend routes - Refresh GitHub workflows and project metadata
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -200,6 +201,25 @@ func (am *AlertManager) SendAlert(data AlertMessageData) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// check if in maintenance window - suppress alerts if so
|
||||
records, _ := am.hub.FindAllRecords("maintenance_windows",
|
||||
dbx.NewExp("status = {:status} AND start_time <= {:now} AND end_time >= {:now} AND suppress_alerts = true",
|
||||
dbx.Params{"status": "scheduled", "now": time.Now()}),
|
||||
)
|
||||
for _, r := range records {
|
||||
// Check if this alert relates to a monitor or domain in maintenance
|
||||
if data.Link != "" {
|
||||
if monitorID := r.GetString("monitor"); monitorID != "" && strings.Contains(data.Link, monitorID) {
|
||||
am.hub.Logger().Info("Alert suppressed due to maintenance window", "monitor", monitorID)
|
||||
return nil
|
||||
}
|
||||
if domainID := r.GetString("domain"); domainID != "" && strings.Contains(data.Link, domainID) {
|
||||
am.hub.Logger().Info("Alert suppressed due to maintenance window", "domain", domainID)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get user settings
|
||||
record, err := am.hub.FindFirstRecordByFilter(
|
||||
"user_settings", "user={:user}",
|
||||
|
||||
Reference in New Issue
Block a user