Documentation ¶
Overview ¶
Package notifier manages notifications for consul-alerts
Package notifier manages notifications for consul-alerts
Index ¶
- Constants
- func Notify(config Config, alert string) error
- func Validate(config Config) error
- type AwsSnsNotifier
- type Config
- type EmailNotifier
- type HipChatNotifier
- type HttpEndpointNotifier
- type ILertNotifier
- type InfluxdbNotifier
- type LogNotifier
- type MattermostAuthInfo
- type MattermostChannelInfo
- type MattermostChannelList
- type MattermostLoginInfo
- type MattermostNotifier
- func (mattermost *MattermostNotifier) Authenticate() bool
- func (mattermost *MattermostNotifier) Copy() Notifier
- func (mattermost *MattermostNotifier) GetAllTeams(teams *[]MattermostTeamInfo) bool
- func (mattermost *MattermostNotifier) GetChannels(teamID string, channels *[]MattermostChannelInfo) bool
- func (mattermost *MattermostNotifier) GetMe(me *MattermostUserInfo) bool
- func (mattermost *MattermostNotifier) GetTeam(teamID string, teamInfo *MattermostTeamInfo) bool
- func (mattermost *MattermostNotifier) GetURL() string
- func (mattermost *MattermostNotifier) GetUser(userID string, userInfo *MattermostUserInfo) bool
- func (mattermost *MattermostNotifier) Init() bool
- func (mattermost *MattermostNotifier) NotifierName() string
- func (mattermost *MattermostNotifier) Notify(messages Messages) bool
- func (mattermost *MattermostNotifier) PostMessage(teamID string, channelID string, postInfo *MattermostPostInfo) bool
- type MattermostPostInfo
- type MattermostTeamInfo
- type MattermostUserInfo
- type MattermostWebhookNotifier
- type Message
- type Messages
- type Notifier
- type Notifiers
- type OpsGenieNotifier
- type PagerDutyNotifier
- type SlackNotifier
- type StringMap
- type TemplateData
- type VictorOpsEvent
- type VictorOpsNotifier
Constants ¶
const ( SYSTEM_HEALTHY string = "HEALTHY" SYSTEM_UNSTABLE string = "UNSTABLE" SYSTEM_CRITICAL string = "CRITICAL" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AwsSnsNotifier ¶
type AwsSnsNotifier struct { ClusterName string `json:"cluster-name"` Enabled bool Region string `json:"region"` TopicArn string `json:"topic-arn"` Template string `json:"template"` }
func (*AwsSnsNotifier) Copy ¶
func (awssns *AwsSnsNotifier) Copy() Notifier
func (*AwsSnsNotifier) NotifierName ¶
func (awssns *AwsSnsNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*AwsSnsNotifier) Notify ¶
func (awssns *AwsSnsNotifier) Notify(messages Messages) bool
type EmailNotifier ¶
type EmailNotifier struct { ClusterName string `json:"cluster-name"` Enabled bool Template string `json:"template"` Url string `json:"url"` Port int `json:"port"` Username string `json:"username"` Password string `json:"password"` SenderAlias string `json:"sender-alias"` SenderEmail string `json:"sender-email"` Receivers []string `json:"receivers"` OnePerAlert bool `json:"one-per-alert"` OnePerNode bool `json:"one-per-node"` }
func (*EmailNotifier) Copy ¶
func (emailNotifier *EmailNotifier) Copy() Notifier
func (*EmailNotifier) NotifierName ¶
func (emailNotifier *EmailNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*EmailNotifier) Notify ¶
func (emailNotifier *EmailNotifier) Notify(alerts Messages) bool
Notify sends messages to the endpoint notifier
type HipChatNotifier ¶
type HipChatNotifier struct { Enabled bool ClusterName string `json:"cluster-name"` RoomId string `json:"room-id"` AuthToken string `json:"auth-token"` BaseURL string `json:"base-url"` From string `json:"from"` }
func (*HipChatNotifier) Copy ¶
func (notifier *HipChatNotifier) Copy() Notifier
func (*HipChatNotifier) NotifierName ¶
func (notifier *HipChatNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*HipChatNotifier) Notify ¶
func (notifier *HipChatNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type HttpEndpointNotifier ¶
type HttpEndpointNotifier struct { Enabled bool ClusterName string `json:"cluster-name"` BaseURL string `json:"base-url"` Endpoint string `json:"endpoint"` Payload map[string]string `json:"payload"` }
func (*HttpEndpointNotifier) Copy ¶
func (notifier *HttpEndpointNotifier) Copy() Notifier
func (*HttpEndpointNotifier) NotifierName ¶
func (notifier *HttpEndpointNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*HttpEndpointNotifier) Notify ¶
func (notifier *HttpEndpointNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type ILertNotifier ¶
type ILertNotifier struct { ApiKey string `json:"api-key"` Enabled bool IncidentKeyTemplate string `json:"incident-key-template"` // contains filtered or unexported fields }
func (*ILertNotifier) Copy ¶
func (il *ILertNotifier) Copy() Notifier
func (*ILertNotifier) NotifierName ¶
func (il *ILertNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*ILertNotifier) Notify ¶
func (il *ILertNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type InfluxdbNotifier ¶
type InfluxdbNotifier struct { Enabled bool Host string `json:"host"` Username string `json:"username"` Password string `json:"password"` Database string `json:"database"` SeriesName string `json:"series-name"` }
func (*InfluxdbNotifier) Copy ¶
func (influxdb *InfluxdbNotifier) Copy() Notifier
func (*InfluxdbNotifier) NotifierName ¶
func (influxdb *InfluxdbNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*InfluxdbNotifier) Notify ¶
func (influxdb *InfluxdbNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type LogNotifier ¶
func (*LogNotifier) Copy ¶
func (logNotifier *LogNotifier) Copy() Notifier
func (*LogNotifier) NotifierName ¶
func (logNotifier *LogNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*LogNotifier) Notify ¶
func (logNotifier *LogNotifier) Notify(alerts Messages) bool
Notify sends messages to the endpoint notifier
type MattermostAuthInfo ¶
type MattermostAuthInfo struct { UserID string `json:"id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` UserName string `json:"username"` AuthData string `json:"auth_data"` AuthService string `json:"auth_service"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` NickName string `json:"nickname"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Roles string `json:"roles"` AllowMarketing bool `json:"allow_marketing"` NotifyProps StringMap `json:"notify_props"` Props StringMap `json:"props"` LastPasswordUpdate int64 `json:"last_password_update"` LastPictureUpdate int64 `json:"last_picture_update"` }
type MattermostChannelInfo ¶
type MattermostChannelInfo struct { ChannelID string `json:"id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` TeamID string `json:"team_id"` Type string `json:"type"` DisplayName string `json:"display_name"` Name string `json:"name"` Header string `json:"header"` Purpose string `json:"purpose"` LastPostAt int64 `json:"last_post_at"` TotalMsgCount int64 `json:"total_msg_count"` ExtraUpdateAt int64 `json:"extra_update_at"` CreatorID string `json:"creator_id"` }
type MattermostChannelList ¶
type MattermostChannelList struct {
Channels []MattermostChannelInfo
}
type MattermostLoginInfo ¶
type MattermostNotifier ¶
type MattermostNotifier struct { ClusterName string Url string UserName string Password string Team string Channel string Detailed bool NotifName string Enabled bool /* Filled in after authentication */ Initialized bool Token string TeamID string UserID string ChannelID string Text string }
func (*MattermostNotifier) Authenticate ¶
func (mattermost *MattermostNotifier) Authenticate() bool
func (*MattermostNotifier) Copy ¶
func (mattermost *MattermostNotifier) Copy() Notifier
func (*MattermostNotifier) GetAllTeams ¶
func (mattermost *MattermostNotifier) GetAllTeams(teams *[]MattermostTeamInfo) bool
func (*MattermostNotifier) GetChannels ¶
func (mattermost *MattermostNotifier) GetChannels(teamID string, channels *[]MattermostChannelInfo) bool
func (*MattermostNotifier) GetMe ¶
func (mattermost *MattermostNotifier) GetMe(me *MattermostUserInfo) bool
func (*MattermostNotifier) GetTeam ¶
func (mattermost *MattermostNotifier) GetTeam(teamID string, teamInfo *MattermostTeamInfo) bool
func (*MattermostNotifier) GetURL ¶
func (mattermost *MattermostNotifier) GetURL() string
func (*MattermostNotifier) GetUser ¶
func (mattermost *MattermostNotifier) GetUser(userID string, userInfo *MattermostUserInfo) bool
func (*MattermostNotifier) Init ¶
func (mattermost *MattermostNotifier) Init() bool
func (*MattermostNotifier) NotifierName ¶
func (mattermost *MattermostNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*MattermostNotifier) Notify ¶
func (mattermost *MattermostNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
func (*MattermostNotifier) PostMessage ¶
func (mattermost *MattermostNotifier) PostMessage(teamID string, channelID string, postInfo *MattermostPostInfo) bool
type MattermostPostInfo ¶
type MattermostPostInfo struct { PostID string `json:"id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` UserID string `json:"user_id"` ChannelID string `json:"channel_id"` RootID string `json:"root_id"` ParentID string `json:"parent_id"` OriginalID string `json:"original_id"` Message string `json:"message"` Type string `json:"type"` Props StringMap `json:"props"` Filenames StringMap `json:"filenames"` PendingPostID string `json:"pending_post_id"` }
type MattermostTeamInfo ¶
type MattermostTeamInfo struct { TeamID string `json:"id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` DisplayName string `json:"display_name"` Name string `json:"name"` Email string `json:"email"` Type string `json:"type"` AllowedDomains string `json:"allowed_domains"` InviteID string `json:"invite_id"` AllowOpenInvite bool `json:"allow_open_invite"` }
type MattermostUserInfo ¶
type MattermostUserInfo struct { UserID string `json:"id"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` DeleteAt int64 `json:"delete_at"` Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Nickname string `json:"nickname"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Password string `json:"password"` AuthData *string `json:"auth_data"` AuthService string `json:"auth_service"` Roles string `json:"roles"` NotifyProps StringMap `json:"notify_props"` Props StringMap `json:"props,omitempty"` LastPasswordUpdate int64 `json:"last_password_update"` LastPictureUpdate int64 `json:"last_picture_update"` FailedAttempts int `json:"failed_attempts"` MfaActive bool `json:"mfa_active"` MfaSecret string `json:"mfa_secret"` }
type MattermostWebhookNotifier ¶
type MattermostWebhookNotifier struct { ClusterName string `json:"cluster_name"` Url string `json:"-"` Channel string `json:"channel"` Username string `json:"username"` IconUrl string `json:"icon_url"` Text string `json:"text,omitempty"` Detailed bool `json:"-"` Enabled bool `json:"enabled"` }
func (*MattermostWebhookNotifier) Copy ¶
func (n *MattermostWebhookNotifier) Copy() Notifier
func (*MattermostWebhookNotifier) NotifierName ¶
func (n *MattermostWebhookNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*MattermostWebhookNotifier) Notify ¶
func (n *MattermostWebhookNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type Message ¶
type Message struct { Node string ServiceId string Service string CheckId string Check string Status string Output string Notes string Interval int RmdCheck time.Time NotifList map[string]bool VarOverrides Notifiers Timestamp time.Time }
func (Message) IsCritical ¶
type Notifiers ¶
type Notifiers struct { Email *EmailNotifier `json:"email"` Log *LogNotifier `json:"log"` Influxdb *InfluxdbNotifier `json:"influxdb"` Slack *SlackNotifier `json:"slack"` Mattermost *MattermostNotifier `json:"mattermost"` MattermostWebhook *MattermostWebhookNotifier `json:"mattermost-webhook"` PagerDuty *PagerDutyNotifier `json:"pagerduty"` HipChat *HipChatNotifier `json:"hipchat"` OpsGenie *OpsGenieNotifier `json:"opsgenie"` AwsSns *AwsSnsNotifier `json:"awssns"` VictorOps *VictorOpsNotifier `json:"victorops"` HttpEndpoint *HttpEndpointNotifier `json:"http-endpoint"` ILert *ILertNotifier `json:"ilert"` Teams *TeamsNotifier `json:"teams"` Custom []string `json:"custom"` }
type OpsGenieNotifier ¶
type OpsGenieNotifier struct { Enabled bool ClusterName string `json:"cluster-name"` ApiKey string `json:"api-key"` }
func (*OpsGenieNotifier) Copy ¶
func (opsgenie *OpsGenieNotifier) Copy() Notifier
func (*OpsGenieNotifier) NotifierName ¶
func (opsgenie *OpsGenieNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*OpsGenieNotifier) Notify ¶
func (opsgenie *OpsGenieNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type PagerDutyNotifier ¶
type PagerDutyNotifier struct { Enabled bool ServiceKey string `json:"service-key"` ClientName string `json:"client-name"` ClientUrl string `json:"client-url"` MaxRetry int `json:"max-retry"` RetryBaseInterval int `json:"retry-base-interval"'` }
func (*PagerDutyNotifier) Copy ¶
func (pd *PagerDutyNotifier) Copy() Notifier
func (*PagerDutyNotifier) NotifierName ¶
func (pd *PagerDutyNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*PagerDutyNotifier) Notify ¶
func (pd *PagerDutyNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type SlackNotifier ¶
type SlackNotifier struct { ClusterName string `json:"cluster_name"` Url string `json:"url"` Channel string `json:"channel"` Username string `json:"username"` IconUrl string `json:"icon_url"` IconEmoji string `json:"icon_emoji"` Text string `json:"text,omitempty"` Attachments []attachment `json:"attachments,omitempty"` Detailed bool `json:"detailed"` Enabled bool `json:"enabled"` }
func (*SlackNotifier) Copy ¶
func (slack *SlackNotifier) Copy() Notifier
func (*SlackNotifier) NotifierName ¶
func (slack *SlackNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*SlackNotifier) Notify ¶
func (slack *SlackNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
type TemplateData ¶
type TemplateData struct { ClusterName string SystemStatus string FailCount int WarnCount int PassCount int Nodes map[string]Messages }
func (TemplateData) IsCritical ¶
func (t TemplateData) IsCritical() bool
func (TemplateData) IsPassing ¶
func (t TemplateData) IsPassing() bool
func (TemplateData) IsWarning ¶
func (t TemplateData) IsWarning() bool
type VictorOpsEvent ¶
type VictorOpsEvent struct { // Explicitly listed by http://victorops.force.com/knowledgebase/articles/Integration/Alert-Ingestion-API-Documentation/ MessageType string `json:"message_type"` EntityID string `json:"entity_id"` Timestamp uint32 `json:"timestamp"` StateMessage string `json:"state_message"` MonitoringTool string `json:"monitoring_tool"` EntityDisplayName string `json:"entity_display_name"` // Helpful fields from http://victorops.force.com/knowledgebase/articles/Getting_Started/Incident-Fields-Glossary/?l=en_US&fs=RelatedArticle HostName string `json:"host_name"` MonitorName string `json:"monitor_name"` // VictorOps lets you add arbitrary fields to help custom notification logic, so we'll set // node, service, service ID, check, and check ID ConsulNode string `json:"consul_node"` ConsulService string `json:"consul_service,omitempty"` ConsulServiceID string `json:"consul_service_id,omitempty"` ConsulCheck string `json:"consul_check"` ConsulCheckID string `json:"consul_check_id"` }
VictorOpsEvent represents the options we'll pass to the VictorOps API
type VictorOpsNotifier ¶
type VictorOpsNotifier struct { Enabled bool APIKey string `json:"api-key"` RoutingKey string `json:"routing-key"` }
VictorOpsNotifier provides configuration options for the VictorOps notifier
func (*VictorOpsNotifier) Copy ¶
func (vo *VictorOpsNotifier) Copy() Notifier
func (*VictorOpsNotifier) NotifierName ¶
func (vo *VictorOpsNotifier) NotifierName() string
NotifierName provides name for notifier selection
func (*VictorOpsNotifier) Notify ¶
func (vo *VictorOpsNotifier) Notify(messages Messages) bool
Notify sends messages to the endpoint notifier
Source Files ¶
- aws-sns-notifier.go
- email-notifier.go
- hipchat-notifier.go
- http-endpoint-notifier.go
- ilert-notifier.go
- influxdb-notifier.go
- log-notifier.go
- mattermost-notifier.go
- mattermost-webhook-notifier.go
- notifier.go
- opsgenie-notifier.go
- pagerduty-notifier.go
- slack-notifier.go
- teams-notifier.go
- templating.go
- victorops-notifier.go