Documentation
¶
Index ¶
- func SendDiscordAlert(discordWebhookURL string, payload WebhookPayload, timeout time.Duration) error
- func SendSlackAlert(slackWebhookURL string, payload WebhookPayload, timeout time.Duration) error
- func SendWebhookAlert(webhookURL string, payload WebhookPayload, timeout time.Duration) error
- type DiscordEmbed
- type DiscordField
- type DiscordFooter
- type DiscordWebhookPayload
- type NotificationEngine
- type SlackBlock
- type SlackBlockKitPayload
- type SlackTextBlock
- type WebhookError
- type WebhookPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendDiscordAlert ¶
func SendDiscordAlert(discordWebhookURL string, payload WebhookPayload, timeout time.Duration) error
SendDiscordAlert dispatches a color-coded Discord Embed alert card with SSRF validation.
func SendSlackAlert ¶
func SendSlackAlert(slackWebhookURL string, payload WebhookPayload, timeout time.Duration) error
SendSlackAlert dispatches a rich Slack Block-Kit formatted alert payload with SSRF validation.
func SendWebhookAlert ¶
func SendWebhookAlert(webhookURL string, payload WebhookPayload, timeout time.Duration) error
SendWebhookAlert dispatches a JSON POST payload to a configured webhook URL with SSRF validation and retries.
Types ¶
type DiscordEmbed ¶
type DiscordEmbed struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
Color int `json:"color"` // Integer color code (0xE74C3C red, 0x2ECC71 green)
Fields []DiscordField `json:"fields,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
}
type DiscordField ¶
type DiscordFooter ¶
type DiscordFooter struct {
}
type DiscordWebhookPayload ¶
type DiscordWebhookPayload struct {
Username string `json:"username,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
Embeds []DiscordEmbed `json:"embeds"`
}
DiscordWebhookPayload represents a rich Discord Embed notification payload.
type NotificationEngine ¶
type NotificationEngine struct{}
NotificationEngine manages multi-channel alert dispatches for incidents.
func NewNotificationEngine ¶
func NewNotificationEngine() *NotificationEngine
NewNotificationEngine creates a new NotificationEngine.
func (*NotificationEngine) NotifyIncidentCreated ¶
func (n *NotificationEngine) NotifyIncidentCreated(monitor db.Monitor, incident db.Incident, webhookURL string)
NotifyIncidentCreated triggers real-time alerts when a new outage incident opens.
func (*NotificationEngine) NotifyIncidentResolved ¶
func (n *NotificationEngine) NotifyIncidentResolved(monitor db.Monitor, incident db.Incident, webhookURL string)
NotifyIncidentResolved triggers real-time alerts when an outage incident resolves.
type SlackBlock ¶
type SlackBlock struct {
Type string `json:"type"` // "header", "section", "divider", "context"
Text *SlackTextBlock `json:"text,omitempty"` // Header or section text
Fields []SlackTextBlock `json:"fields,omitempty"` // Key-value grid fields
}
type SlackBlockKitPayload ¶
type SlackBlockKitPayload struct {
Text string `json:"text"`
Blocks []SlackBlock `json:"blocks,omitempty"`
}
SlackBlockKitPayload represents a rich Slack Block-Kit notification payload.
type SlackTextBlock ¶
type WebhookError ¶
type WebhookError string
func (WebhookError) Error ¶
func (e WebhookError) Error() string
type WebhookPayload ¶
type WebhookPayload struct {
Event string `json:"event"` // "incident.open" or "incident.resolved"
MonitorID string `json:"monitor_id"` // Target monitor UUID
MonitorName string `json:"monitor_name"` // Target monitor name
TargetURL string `json:"target_url"` // Target URL
Status string `json:"status"` // "DOWN" or "UP"
Cause string `json:"cause"` // Outage cause description
Timestamp string `json:"timestamp"` // ISO-8601 timestamp
}
WebhookPayload represents the JSON notification format dispatched to external webhooks.