Documentation
¶
Overview ¶
Package alerts handles alert management and delivery.
Index ¶
- func DeleteUserAlerts(e *core.RequestEvent) error
- func UpsertUserAlerts(e *core.RequestEvent) error
- type AlertManager
- func (am *AlertManager) HandleStatusAlerts(newStatus string, systemRecord *core.Record) error
- func (am *AlertManager) HandleSystemAlerts(systemRecord *core.Record, data *system.CombinedData) error
- func (am *AlertManager) IsNotificationSilenced(userID, systemID string) bool
- func (am *AlertManager) SendAlert(data AlertMessageData) error
- func (am *AlertManager) SendShoutrrrAlert(notificationUrl, title, message, link, linkText string) error
- func (am *AlertManager) SendTestNotification(e *core.RequestEvent) error
- func (am *AlertManager) StopWorker()
- type AlertMessageData
- type SystemAlertData
- type SystemAlertGPUData
- type SystemAlertStats
- type UserNotificationSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteUserAlerts ¶
func DeleteUserAlerts(e *core.RequestEvent) error
DeleteUserAlerts handles API request to delete alerts for a user across multiple systems (DELETE /api/beszel/user-alerts)
func UpsertUserAlerts ¶
func UpsertUserAlerts(e *core.RequestEvent) error
UpsertUserAlerts handles API request to create or update alerts for a user across multiple systems (POST /api/beszel/user-alerts)
Types ¶
type AlertManager ¶
type AlertManager struct {
// contains filtered or unexported fields
}
func NewAlertManager ¶
func NewAlertManager(app hubLike) *AlertManager
NewAlertManager creates a new AlertManager instance.
func (*AlertManager) HandleStatusAlerts ¶
func (am *AlertManager) HandleStatusAlerts(newStatus string, systemRecord *core.Record) error
HandleStatusAlerts manages the logic when system status changes.
func (*AlertManager) HandleSystemAlerts ¶
func (am *AlertManager) HandleSystemAlerts(systemRecord *core.Record, data *system.CombinedData) error
func (*AlertManager) IsNotificationSilenced ¶ added in v0.17.0
func (am *AlertManager) IsNotificationSilenced(userID, systemID string) bool
IsNotificationSilenced checks if a notification should be silenced based on configured quiet hours
func (*AlertManager) SendAlert ¶
func (am *AlertManager) SendAlert(data AlertMessageData) error
SendAlert sends an alert to the user
func (*AlertManager) SendShoutrrrAlert ¶
func (am *AlertManager) SendShoutrrrAlert(notificationUrl, title, message, link, linkText string) error
SendShoutrrrAlert sends an alert via a Shoutrrr URL
func (*AlertManager) SendTestNotification ¶
func (am *AlertManager) SendTestNotification(e *core.RequestEvent) error
func (*AlertManager) StopWorker ¶
func (am *AlertManager) StopWorker()
StopWorker shuts down the AlertManager.worker goroutine
type AlertMessageData ¶
type SystemAlertData ¶
type SystemAlertData struct {
// contains filtered or unexported fields
}
type SystemAlertGPUData ¶ added in v0.16.0
type SystemAlertGPUData struct {
Usage float64 `json:"u"`
}
type SystemAlertStats ¶
type SystemAlertStats struct {
Cpu float64 `json:"cpu"`
Mem float64 `json:"mp"`
Disk float64 `json:"dp"`
NetSent float64 `json:"ns"`
NetRecv float64 `json:"nr"`
GPU map[string]SystemAlertGPUData `json:"g"`
Temperatures map[string]float32 `json:"t"`
LoadAvg [3]float64 `json:"la"`
Battery [2]uint8 `json:"bat"`
}