Documentation
¶
Index ¶
- Constants
- Variables
- type AlertmanagerNotifier
- type Base
- type DingDingNotifier
- type DiscordNotifier
- type EmailNotifier
- type ExtendedAlert
- type ExtendedAlerts
- type ExtendedData
- type GetDecryptedValueFn
- type GoogleChatNotifier
- type KafkaNotifier
- type LineNotifier
- type NotificationChannelConfig
- type OpsgenieNotifier
- type PagerdutyNotifier
- type PushoverNotifier
- type SensuGoNotifier
- type SlackNotifier
- type TeamsNotifier
- type TelegramNotifier
- type ThreemaNotifier
- type VictoropsNotifier
- type WebhookNotifier
Constants ¶
const ( OpsgenieSendTags = "tags" OpsgenieSendDetails = "details" OpsgenieSendBoth = "both" )
const ( ColorAlertFiring = "#D63232" ColorAlertResolved = "#36a64f" )
const TemplateForTestsString = `` /* 1311-byte string literal not displayed */
TemplateForTestsString is the template used for unit tests and integration tests. We have it separate from above default template because any tiny change in the template will require updating almost all channel tests (15+ files) and it's very time consuming.
Variables ¶
var ( OpsgenieAlertURL = "https://api.opsgenie.com/v2/alerts" ValidPriorities = map[string]bool{"P1": true, "P2": true, "P3": true, "P4": true, "P5": true} )
var DefaultTemplateString = `` /* 2108-byte string literal not displayed */
var GetBoundary = func() string {
return ""
}
GetBoundary is used for overriding the behaviour for tests and set a boundary for multipart body. DO NOT set this outside tests.
var (
LineNotifyURL string = "https://notify-api.line.me/api/notify"
)
var (
PagerdutyEventAPIURL = "https://events.pagerduty.com/v2/enqueue"
)
var (
PushoverEndpoint = "https://api.pushover.net/1/messages.json"
)
var SlackAPIEndpoint = "https://slack.com/api/chat.postMessage"
var (
TelegramAPIURL = "https://api.telegram.org/bot%s/sendMessage"
)
var (
ThreemaGwBaseURL = "https://msgapi.threema.ch/send_simple"
)
Functions ¶
This section is empty.
Types ¶
type AlertmanagerNotifier ¶
type AlertmanagerNotifier struct { *Base // contains filtered or unexported fields }
AlertmanagerNotifier sends alert notifications to the alert manager
func NewAlertmanagerNotifier ¶
func NewAlertmanagerNotifier(model *NotificationChannelConfig, _ *template.Template, fn GetDecryptedValueFn) (*AlertmanagerNotifier, error)
NewAlertmanagerNotifier returns a new Alertmanager notifier.
func (*AlertmanagerNotifier) SendResolved ¶
func (n *AlertmanagerNotifier) SendResolved() bool
type Base ¶
type Base struct { Name string Type string UID string IsDefault bool DisableResolveMessage bool // contains filtered or unexported fields }
Base is the base implementation of a notifier. It contains the common fields across all notifier types.
func NewBase ¶
func NewBase(model *models.AlertNotification) *Base
func (*Base) GetDisableResolveMessage ¶
type DingDingNotifier ¶
type DingDingNotifier struct { *Base MsgType string URL string Message string // contains filtered or unexported fields }
DingDingNotifier is responsible for sending alert notifications to ding ding.
func NewDingDingNotifier ¶
func NewDingDingNotifier(model *NotificationChannelConfig, t *template.Template) (*DingDingNotifier, error)
NewDingDingNotifier is the constructor for the Dingding notifier
func (*DingDingNotifier) SendResolved ¶
func (dd *DingDingNotifier) SendResolved() bool
type DiscordNotifier ¶
type DiscordNotifier struct { *Base Content string AvatarURL string WebhookURL string UseDiscordUsername bool // contains filtered or unexported fields }
func NewDiscordNotifier ¶
func NewDiscordNotifier(model *NotificationChannelConfig, t *template.Template) (*DiscordNotifier, error)
func (DiscordNotifier) SendResolved ¶
func (d DiscordNotifier) SendResolved() bool
type EmailNotifier ¶
type EmailNotifier struct { *Base Addresses []string SingleEmail bool Message string // contains filtered or unexported fields }
EmailNotifier is responsible for sending alert notifications over email.
func NewEmailNotifier ¶
func NewEmailNotifier(model *NotificationChannelConfig, t *template.Template) (*EmailNotifier, error)
NewEmailNotifier is the constructor function for the EmailNotifier.
func (*EmailNotifier) SendResolved ¶
func (en *EmailNotifier) SendResolved() bool
type ExtendedAlert ¶
type ExtendedAlert struct { Status string `json:"status"` Labels template.KV `json:"labels"` Annotations template.KV `json:"annotations"` StartsAt time.Time `json:"startsAt"` EndsAt time.Time `json:"endsAt"` GeneratorURL string `json:"generatorURL"` Fingerprint string `json:"fingerprint"` SilenceURL string `json:"silenceURL"` DashboardURL string `json:"dashboardURL"` PanelURL string `json:"panelURL"` ValueString string `json:"valueString"` }
type ExtendedAlerts ¶
type ExtendedAlerts []ExtendedAlert
func (ExtendedAlerts) Firing ¶
func (as ExtendedAlerts) Firing() []ExtendedAlert
Firing returns the subset of alerts that are firing.
func (ExtendedAlerts) Resolved ¶
func (as ExtendedAlerts) Resolved() []ExtendedAlert
Resolved returns the subset of alerts that are resolved.
type ExtendedData ¶
type ExtendedData struct { Receiver string `json:"receiver"` Status string `json:"status"` Alerts ExtendedAlerts `json:"alerts"` GroupLabels template.KV `json:"groupLabels"` CommonLabels template.KV `json:"commonLabels"` CommonAnnotations template.KV `json:"commonAnnotations"` ExternalURL string `json:"externalURL"` }
func ExtendData ¶
func ExtendData(data *template.Data, logger log.Logger) *ExtendedData
type GetDecryptedValueFn ¶
type GetDecryptedValueFn func(ctx context.Context, sjd map[string][]byte, key string, fallback string) string
GetDecryptedValueFn is a function that returns the decrypted value of the given key. If the key is not present, then it returns the fallback value.
type GoogleChatNotifier ¶
GoogleChatNotifier is responsible for sending alert notifications to Google chat.
func NewGoogleChatNotifier ¶
func NewGoogleChatNotifier(model *NotificationChannelConfig, t *template.Template) (*GoogleChatNotifier, error)
func (*GoogleChatNotifier) SendResolved ¶
func (gcn *GoogleChatNotifier) SendResolved() bool
type KafkaNotifier ¶
type KafkaNotifier struct { *Base Endpoint string Topic string // contains filtered or unexported fields }
KafkaNotifier is responsible for sending alert notifications to Kafka.
func NewKafkaNotifier ¶
func NewKafkaNotifier(model *NotificationChannelConfig, t *template.Template) (*KafkaNotifier, error)
NewKafkaNotifier is the constructor function for the Kafka notifier.
func (*KafkaNotifier) SendResolved ¶
func (kn *KafkaNotifier) SendResolved() bool
type LineNotifier ¶
LineNotifier is responsible for sending alert notifications to LINE.
func NewLineNotifier ¶
func NewLineNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*LineNotifier, error)
NewLineNotifier is the constructor for the LINE notifier
func (*LineNotifier) SendResolved ¶
func (ln *LineNotifier) SendResolved() bool
type NotificationChannelConfig ¶
type NotificationChannelConfig struct { OrgID int64 // only used internally UID string `json:"uid"` Name string `json:"name"` Type string `json:"type"` DisableResolveMessage bool `json:"disableResolveMessage"` Settings *simplejson.Json `json:"settings"` SecureSettings map[string][]byte `json:"secureSettings"` }
type OpsgenieNotifier ¶
type OpsgenieNotifier struct { *Base APIKey string APIUrl string AutoClose bool OverridePriority bool SendTagsAs string // contains filtered or unexported fields }
OpsgenieNotifier is responsible for sending alert notifications to Opsgenie.
func NewOpsgenieNotifier ¶
func NewOpsgenieNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*OpsgenieNotifier, error)
NewOpsgenieNotifier is the constructor for the Opsgenie notifier
func (*OpsgenieNotifier) SendResolved ¶
func (on *OpsgenieNotifier) SendResolved() bool
type PagerdutyNotifier ¶
type PagerdutyNotifier struct { *Base Key string Severity string CustomDetails map[string]string Class string Component string Group string Summary string // contains filtered or unexported fields }
PagerdutyNotifier is responsible for sending alert notifications to pagerduty
func NewPagerdutyNotifier ¶
func NewPagerdutyNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*PagerdutyNotifier, error)
NewPagerdutyNotifier is the constructor for the PagerDuty notifier
func (*PagerdutyNotifier) SendResolved ¶
func (pn *PagerdutyNotifier) SendResolved() bool
type PushoverNotifier ¶
type PushoverNotifier struct { *Base UserKey string APIToken string AlertingPriority int OKPriority int Retry int Expire int Device string AlertingSound string OKSound string Upload bool Message string // contains filtered or unexported fields }
PushoverNotifier is responsible for sending alert notifications to Pushover
func NewPushoverNotifier ¶
func NewPushoverNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*PushoverNotifier, error)
NewSlackNotifier is the constructor for the Slack notifier
func (*PushoverNotifier) SendResolved ¶
func (pn *PushoverNotifier) SendResolved() bool
type SensuGoNotifier ¶
type SensuGoNotifier struct { *Base URL string Entity string Check string Namespace string Handler string APIKey string Message string // contains filtered or unexported fields }
func NewSensuGoNotifier ¶
func NewSensuGoNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*SensuGoNotifier, error)
NewSensuGoNotifier is the constructor for the SensuGo notifier
func (*SensuGoNotifier) SendResolved ¶
func (sn *SensuGoNotifier) SendResolved() bool
type SlackNotifier ¶
type SlackNotifier struct { *Base URL *url.URL Username string IconEmoji string IconURL string Recipient string Text string Title string MentionUsers []string MentionGroups []string MentionChannel string Token string // contains filtered or unexported fields }
SlackNotifier is responsible for sending alert notification to Slack.
func NewSlackNotifier ¶
func NewSlackNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*SlackNotifier, error)
NewSlackNotifier is the constructor for the Slack notifier
func (*SlackNotifier) SendResolved ¶
func (sn *SlackNotifier) SendResolved() bool
type TeamsNotifier ¶
type TeamsNotifier struct { *Base URL string Message string // contains filtered or unexported fields }
TeamsNotifier is responsible for sending alert notifications to Microsoft teams.
func NewTeamsNotifier ¶
func NewTeamsNotifier(model *NotificationChannelConfig, t *template.Template) (*TeamsNotifier, error)
NewTeamsNotifier is the constructor for Teams notifier.
func (*TeamsNotifier) SendResolved ¶
func (tn *TeamsNotifier) SendResolved() bool
type TelegramNotifier ¶
type TelegramNotifier struct { *Base BotToken string ChatID string Message string // contains filtered or unexported fields }
TelegramNotifier is responsible for sending alert notifications to Telegram.
func NewTelegramNotifier ¶
func NewTelegramNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*TelegramNotifier, error)
NewTelegramNotifier is the constructor for the Telegram notifier
func (*TelegramNotifier) SendResolved ¶
func (tn *TelegramNotifier) SendResolved() bool
type ThreemaNotifier ¶
type ThreemaNotifier struct { *Base GatewayID string RecipientID string APISecret string // contains filtered or unexported fields }
ThreemaNotifier is responsible for sending alert notifications to Threema.
func NewThreemaNotifier ¶
func NewThreemaNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*ThreemaNotifier, error)
NewThreemaNotifier is the constructor for the Threema notifier
func (*ThreemaNotifier) SendResolved ¶
func (tn *ThreemaNotifier) SendResolved() bool
type VictoropsNotifier ¶
type VictoropsNotifier struct { *Base URL string MessageType string // contains filtered or unexported fields }
VictoropsNotifier defines URL property for Victorops REST API and handles notification process by formatting POST body according to Victorops specifications (http://victorops.force.com/knowledgebase/articles/Integration/Alert-Ingestion-API-Documentation/)
func NewVictoropsNotifier ¶
func NewVictoropsNotifier(model *NotificationChannelConfig, t *template.Template) (*VictoropsNotifier, error)
NewVictoropsNotifier creates an instance of VictoropsNotifier that handles posting notifications to Victorops REST API
func (*VictoropsNotifier) SendResolved ¶
func (vn *VictoropsNotifier) SendResolved() bool
type WebhookNotifier ¶
type WebhookNotifier struct { *Base URL string User string Password string HTTPMethod string MaxAlerts int // contains filtered or unexported fields }
WebhookNotifier is responsible for sending alert notifications as webhooks.
func NewWebHookNotifier ¶
func NewWebHookNotifier(model *NotificationChannelConfig, t *template.Template, fn GetDecryptedValueFn) (*WebhookNotifier, error)
NewWebHookNotifier is the constructor for the WebHook notifier.
func (*WebhookNotifier) SendResolved ¶
func (wn *WebhookNotifier) SendResolved() bool