Documentation ¶
Index ¶
- Variables
- func NewConsoleService(stdout io.Writer) *consoleService
- type AlertmanagerNotification
- type AlertmanagerOptions
- type BasicAuth
- type Destination
- type Destinations
- type EmailNotification
- type EmailOptions
- type GitHubNotification
- type GitHubOptions
- type GitHubStatus
- type GoogleChatNotification
- type GoogleChatOptions
- type GrafanaAnnotation
- type GrafanaOptions
- type Header
- type MattermostNotification
- type MattermostOptions
- type NewrelicNotification
- type NewrelicOptions
- type Notification
- type NotificationService
- func NewAlertmanagerService(opts AlertmanagerOptions) NotificationService
- func NewEmailService(opts EmailOptions) NotificationService
- func NewGitHubService(opts GitHubOptions) (NotificationService, error)
- func NewGoogleChatService(opts GoogleChatOptions) NotificationService
- func NewGrafanaService(opts GrafanaOptions) NotificationService
- func NewMattermostService(opts MattermostOptions) NotificationService
- func NewNewrelicService(opts NewrelicOptions) NotificationService
- func NewOpsgenieService(opts OpsgenieOptions) NotificationService
- func NewPagerdutyService(opts PagerdutyOptions) NotificationService
- func NewPushoverService(opts PushoverOptions) NotificationService
- func NewRocketChatService(opts RocketChatOptions) NotificationService
- func NewService(serviceType string, optsData []byte) (NotificationService, error)
- func NewSlackService(opts SlackOptions) NotificationService
- func NewTeamsService(opts TeamsOptions) NotificationService
- func NewTelegramService(opts TelegramOptions) NotificationService
- func NewWebexService(opts WebexOptions) NotificationService
- func NewWebhookService(opts WebhookOptions) NotificationService
- type OpsgenieNotification
- type OpsgenieOptions
- type PagerDutyNotification
- type PagerdutyOptions
- type PushoverOptions
- type RocketChatNotification
- type RocketChatOptions
- type SlackNotification
- type SlackOptions
- type TeamsNotification
- type TeamsOptions
- type TelegramOptions
- type Templater
- type TemplaterSource
- type WebexOptions
- type WebhookNotification
- type WebhookNotifications
- type WebhookOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingConfig = errors.New("config is missing") ErrMissingApiKey = errors.New("apiKey is missing") )
Functions ¶
func NewConsoleService ¶
Types ¶
type AlertmanagerNotification ¶ added in v0.3.0
type AlertmanagerNotification struct { Labels map[string]string `json:"labels"` Annotations map[string]string `json:"annotations"` GeneratorURL string `json:"generatorURL"` StartsAt time.Time `json:"startsAt"` }
AlertmanagerNotification message body is similar to Prometheus alertmanager postableAlert model
func (AlertmanagerNotification) GetTemplater ¶ added in v0.3.0
func (n AlertmanagerNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
GetTemplater parse text template
type AlertmanagerOptions ¶ added in v0.3.0
type AlertmanagerOptions struct { Targets []string `json:"targets"` Scheme string `json:"scheme"` APIPath string `json:"apiPath"` BasicAuth *BasicAuth `json:"basicAuth"` BearerToken string `json:"bearerToken"` InsecureSkipVerify bool `json:"insecureSkipVerify"` Timeout int `json:"timeout"` }
AlertmanagerOptions cluster configuration
type Destination ¶
Destination holds notification destination details
type Destinations ¶
type Destinations map[string][]Destination
Destinations holds notification destinations group by trigger
func (Destinations) Dedup ¶
func (s Destinations) Dedup() Destinations
func (Destinations) Merge ¶
func (s Destinations) Merge(other Destinations)
type EmailNotification ¶
type EmailNotification struct { Subject string `json:"subject,omitempty"` Body string `json:"body,omitempty"` }
func (*EmailNotification) GetTemplater ¶
func (n *EmailNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type EmailOptions ¶
type GitHubNotification ¶
type GitHubNotification struct { Status *GitHubStatus `json:"status,omitempty"` RepoURLPath string `json:"repoURLPath,omitempty"` RevisionPath string `json:"revisionPath,omitempty"` // contains filtered or unexported fields }
func (*GitHubNotification) GetTemplater ¶
func (g *GitHubNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type GitHubOptions ¶
type GitHubStatus ¶
type GoogleChatNotification ¶ added in v0.3.0
type GoogleChatNotification struct { Cards string `json:"cards"` ThreadKey string `json:"threadKey,omitempty"` }
func (*GoogleChatNotification) GetTemplater ¶ added in v0.3.0
func (n *GoogleChatNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type GoogleChatOptions ¶ added in v0.3.0
type GrafanaAnnotation ¶
type GrafanaOptions ¶
type MattermostNotification ¶
type MattermostNotification struct {
Attachments string `json:"attachments,omitempty"`
}
func (*MattermostNotification) GetTemplater ¶
func (n *MattermostNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type MattermostOptions ¶
type NewrelicNotification ¶ added in v0.4.0
type NewrelicNotification struct { Revision string `json:"revision"` Changelog string `json:"changelog,omitempty"` Description string `json:"description,omitempty"` User string `json:"user,omitempty"` }
func (*NewrelicNotification) GetTemplater ¶ added in v0.4.0
func (n *NewrelicNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type NewrelicOptions ¶ added in v0.4.0
type Notification ¶
type Notification struct { Message string `json:"message,omitempty"` Email *EmailNotification `json:"email,omitempty"` Slack *SlackNotification `json:"slack,omitempty"` Mattermost *MattermostNotification `json:"mattermost,omitempty"` RocketChat *RocketChatNotification `json:"rocketchat,omitempty"` Teams *TeamsNotification `json:"teams,omitempty"` Webhook WebhookNotifications `json:"webhook,omitempty"` Opsgenie *OpsgenieNotification `json:"opsgenie,omitempty"` GitHub *GitHubNotification `json:"github,omitempty"` Alertmanager *AlertmanagerNotification `json:"alertmanager,omitempty"` GoogleChat *GoogleChatNotification `json:"googlechat,omitempty"` Pagerduty *PagerDutyNotification `json:"pagerduty,omitempty"` Newrelic *NewrelicNotification `json:"newrelic,omitempty"` }
func (*Notification) GetTemplater ¶
func (n *Notification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
func (*Notification) Preview ¶
func (n *Notification) Preview() string
type NotificationService ¶
type NotificationService interface {
Send(notification Notification, dest Destination) error
}
NotificationService defines notification service interface
func NewAlertmanagerService ¶ added in v0.3.0
func NewAlertmanagerService(opts AlertmanagerOptions) NotificationService
NewAlertmanagerService new service
func NewEmailService ¶
func NewEmailService(opts EmailOptions) NotificationService
func NewGitHubService ¶
func NewGitHubService(opts GitHubOptions) (NotificationService, error)
func NewGoogleChatService ¶ added in v0.3.0
func NewGoogleChatService(opts GoogleChatOptions) NotificationService
func NewGrafanaService ¶
func NewGrafanaService(opts GrafanaOptions) NotificationService
func NewMattermostService ¶
func NewMattermostService(opts MattermostOptions) NotificationService
func NewNewrelicService ¶ added in v0.4.0
func NewNewrelicService(opts NewrelicOptions) NotificationService
func NewOpsgenieService ¶
func NewOpsgenieService(opts OpsgenieOptions) NotificationService
func NewPagerdutyService ¶ added in v0.4.0
func NewPagerdutyService(opts PagerdutyOptions) NotificationService
func NewPushoverService ¶ added in v0.3.0
func NewPushoverService(opts PushoverOptions) NotificationService
func NewRocketChatService ¶
func NewRocketChatService(opts RocketChatOptions) NotificationService
func NewService ¶
func NewService(serviceType string, optsData []byte) (NotificationService, error)
func NewSlackService ¶
func NewSlackService(opts SlackOptions) NotificationService
func NewTeamsService ¶
func NewTeamsService(opts TeamsOptions) NotificationService
func NewTelegramService ¶
func NewTelegramService(opts TelegramOptions) NotificationService
func NewWebexService ¶ added in v0.4.0
func NewWebexService(opts WebexOptions) NotificationService
func NewWebhookService ¶
func NewWebhookService(opts WebhookOptions) NotificationService
type OpsgenieNotification ¶
type OpsgenieNotification struct {
Description string `json:"description"`
}
func (*OpsgenieNotification) GetTemplater ¶
func (n *OpsgenieNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type OpsgenieOptions ¶
type PagerDutyNotification ¶ added in v0.4.0
type PagerDutyNotification struct { Title string `json:"title"` Body string `json:"body,omitempty"` Urgency string `json:"urgency,omitempty"` PriorityId string `json:"priorityId,omitempty"` }
func (*PagerDutyNotification) GetTemplater ¶ added in v0.4.0
func (p *PagerDutyNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type PagerdutyOptions ¶ added in v0.4.0
type PushoverOptions ¶ added in v0.3.0
type PushoverOptions struct {
Token string `json:"token"`
}
type RocketChatNotification ¶
type RocketChatNotification struct {
Attachments string `json:"attachments,omitempty"`
}
func (*RocketChatNotification) GetTemplater ¶
func (n *RocketChatNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type RocketChatOptions ¶
type SlackNotification ¶
type SlackNotification struct { Attachments string `json:"attachments,omitempty"` Blocks string `json:"blocks,omitempty"` GroupingKey string `json:"groupingKey"` NotifyBroadcast bool `json:"notifyBroadcast"` DeliveryPolicy slackutil.DeliveryPolicy `json:"deliveryPolicy"` }
func (*SlackNotification) GetTemplater ¶
func (n *SlackNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type SlackOptions ¶
type TeamsNotification ¶
type TeamsNotification struct { Template string `json:"template,omitempty"` Title string `json:"title,omitempty"` Summary string `json:"summary,omitempty"` Text string `json:"text,omitempty"` ThemeColor string `json:"themeColor,omitempty"` Facts string `json:"facts,omitempty"` Sections string `json:"sections,omitempty"` PotentialAction string `json:"potentialAction,omitempty"` }
func (*TeamsNotification) GetTemplater ¶
func (n *TeamsNotification) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
type TeamsOptions ¶
type TelegramOptions ¶
type TelegramOptions struct {
Token string `json:"token"`
}
type Templater ¶
type Templater func(notification *Notification, vars map[string]interface{}) error
type TemplaterSource ¶
type TemplaterSource interface {
GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
}
type WebexOptions ¶ added in v0.4.0
type WebhookNotification ¶
type WebhookNotifications ¶
type WebhookNotifications map[string]WebhookNotification
func (WebhookNotifications) GetTemplater ¶
func (n WebhookNotifications) GetTemplater(name string, f texttemplate.FuncMap) (Templater, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.