Documentation
¶
Index ¶
- type AlertLogEntry
- type AlertLogger
- type AlertNotifierAdapter
- type DesktopNotifyChannel
- type DesktopNotifyConfig
- type LogFileChannel
- type LogFileConfig
- type NotificationChannel
- type NotificationConfig
- type NotificationManager
- type TerminalBellChannel
- type TerminalBellConfig
- type WebhookChannel
- type WebhookConfig
- type WebhookPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertLogEntry ¶
type AlertLogEntry struct {
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
Title string `json:"title"`
Message string `json:"message"`
Source string `json:"source"`
ID string `json:"id"`
}
AlertLogEntry represents a log entry for an alert
type AlertLogger ¶
type AlertLogger struct {
// contains filtered or unexported fields
}
AlertLogger handles logging alerts to file
func NewAlertLogger ¶
func NewAlertLogger(logPath string) *AlertLogger
NewAlertLogger creates a new alert logger
func (*AlertLogger) LogAlert ¶
func (al *AlertLogger) LogAlert(alert *components.Alert) error
LogAlert logs an alert to file
type AlertNotifierAdapter ¶
type AlertNotifierAdapter struct {
// contains filtered or unexported fields
}
AlertNotifierAdapter adapts NotificationManager to the AlertNotifier interface
func NewAlertNotifierAdapter ¶
func NewAlertNotifierAdapter(manager *NotificationManager) *AlertNotifierAdapter
NewAlertNotifierAdapter creates a new adapter
func (*AlertNotifierAdapter) Notify ¶
func (a *AlertNotifierAdapter) Notify(alert *components.Alert)
Notify implements the AlertNotifier interface
type DesktopNotifyChannel ¶
type DesktopNotifyChannel struct {
// contains filtered or unexported fields
}
DesktopNotifyChannel implements desktop notifications
func NewDesktopNotifyChannel ¶
func NewDesktopNotifyChannel(config DesktopNotifyConfig) *DesktopNotifyChannel
NewDesktopNotifyChannel creates a new desktop notification channel
func (*DesktopNotifyChannel) Configure ¶
func (d *DesktopNotifyChannel) Configure(config map[string]interface{}) error
Configure updates channel configuration
func (*DesktopNotifyChannel) IsEnabled ¶
func (d *DesktopNotifyChannel) IsEnabled() bool
IsEnabled returns whether the channel is enabled
func (*DesktopNotifyChannel) Name ¶
func (d *DesktopNotifyChannel) Name() string
Name returns the channel name
func (*DesktopNotifyChannel) Notify ¶
func (d *DesktopNotifyChannel) Notify(alert *components.Alert) error
Notify sends a desktop notification
type DesktopNotifyConfig ¶
type DesktopNotifyConfig struct {
Enabled bool `json:"enabled"`
MinAlertLevel int `json:"min_alert_level"`
Timeout int `json:"timeout"` // Notification timeout in seconds
}
DesktopNotifyConfig holds configuration for desktop notifications
type LogFileChannel ¶
type LogFileChannel struct {
// contains filtered or unexported fields
}
LogFileChannel implements log file notifications
func NewLogFileChannel ¶
func NewLogFileChannel(config LogFileConfig) *LogFileChannel
NewLogFileChannel creates a new log file notification channel
func (*LogFileChannel) Configure ¶
func (l *LogFileChannel) Configure(config map[string]interface{}) error
Configure updates channel configuration
func (*LogFileChannel) IsEnabled ¶
func (l *LogFileChannel) IsEnabled() bool
IsEnabled returns whether the channel is enabled
func (*LogFileChannel) Notify ¶
func (l *LogFileChannel) Notify(alert *components.Alert) error
Notify logs the alert (actual logging is handled by AlertLogger in NotificationManager)
type LogFileConfig ¶
LogFileConfig holds configuration for log file notifications
type NotificationChannel ¶
type NotificationChannel interface {
// Name returns the channel name
Name() string
// IsEnabled returns whether the channel is enabled
IsEnabled() bool
// Notify sends a notification through this channel
Notify(alert *components.Alert) error
// Configure updates channel configuration
Configure(config map[string]interface{}) error
}
NotificationChannel represents a notification delivery channel
type NotificationConfig ¶
type NotificationConfig struct {
// Global settings
EnableNotifications bool `json:"enable_notifications"`
MinAlertLevel int `json:"min_alert_level"` // Minimum alert level to notify
// Channel-specific settings
TerminalBell TerminalBellConfig `json:"terminal_bell"`
LogFile LogFileConfig `json:"log_file"`
DesktopNotify DesktopNotifyConfig `json:"desktop_notify"`
Webhook WebhookConfig `json:"webhook"`
}
NotificationConfig holds configuration for all notification channels
type NotificationManager ¶
type NotificationManager struct {
// contains filtered or unexported fields
}
NotificationManager manages all notification channels
func NewNotificationManager ¶
func NewNotificationManager(configPath string) (*NotificationManager, error)
NewNotificationManager creates a new notification manager
func (*NotificationManager) GetConfig ¶
func (nm *NotificationManager) GetConfig() *NotificationConfig
GetConfig returns the current configuration
func (*NotificationManager) Notify ¶
func (nm *NotificationManager) Notify(alert *components.Alert)
Notify sends an alert through all enabled channels
func (*NotificationManager) UpdateConfig ¶
func (nm *NotificationManager) UpdateConfig(config *NotificationConfig) error
UpdateConfig updates the notification configuration
type TerminalBellChannel ¶
type TerminalBellChannel struct {
// contains filtered or unexported fields
}
TerminalBellChannel implements terminal bell notifications
func NewTerminalBellChannel ¶
func NewTerminalBellChannel(config TerminalBellConfig) *TerminalBellChannel
NewTerminalBellChannel creates a new terminal bell notification channel
func (*TerminalBellChannel) Configure ¶
func (t *TerminalBellChannel) Configure(config map[string]interface{}) error
Configure updates channel configuration
func (*TerminalBellChannel) IsEnabled ¶
func (t *TerminalBellChannel) IsEnabled() bool
IsEnabled returns whether the channel is enabled
func (*TerminalBellChannel) Name ¶
func (t *TerminalBellChannel) Name() string
Name returns the channel name
func (*TerminalBellChannel) Notify ¶
func (t *TerminalBellChannel) Notify(alert *components.Alert) error
Notify sends a terminal bell notification
type TerminalBellConfig ¶
type TerminalBellConfig struct {
Enabled bool `json:"enabled"`
MinAlertLevel int `json:"min_alert_level"`
RepeatCount int `json:"repeat_count"` // Number of bells for critical alerts
}
TerminalBellConfig holds configuration for terminal bell notifications
type WebhookChannel ¶
type WebhookChannel struct {
// contains filtered or unexported fields
}
WebhookChannel implements webhook notifications
func NewWebhookChannel ¶
func NewWebhookChannel(config WebhookConfig) *WebhookChannel
NewWebhookChannel creates a new webhook notification channel
func (*WebhookChannel) Configure ¶
func (w *WebhookChannel) Configure(config map[string]interface{}) error
Configure updates channel configuration
func (*WebhookChannel) IsEnabled ¶
func (w *WebhookChannel) IsEnabled() bool
IsEnabled returns whether the channel is enabled
func (*WebhookChannel) Notify ¶
func (w *WebhookChannel) Notify(alert *components.Alert) error
Notify sends a webhook notification
type WebhookConfig ¶
type WebhookConfig struct {
Enabled bool `json:"enabled"`
URL string `json:"url"`
MinAlertLevel int `json:"min_alert_level"`
Headers map[string]string `json:"headers"`
Timeout int `json:"timeout"` // Request timeout in seconds
RetryCount int `json:"retry_count"`
}
WebhookConfig holds configuration for webhook notifications
type WebhookPayload ¶
type WebhookPayload struct {
Timestamp time.Time `json:"timestamp"`
Level string `json:"level"`
LevelInt int `json:"level_int"`
Title string `json:"title"`
Message string `json:"message"`
Source string `json:"source"`
AlertID string `json:"alert_id"`
ClusterName string `json:"cluster_name,omitempty"`
}
WebhookPayload represents the payload sent to the webhook