notifiers

package
v0.0.1-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 23 Imported by: 132

Documentation

Index

Constants

View Source
const AlertStateCritical = "CRITICAL"

AlertStateCritical - Victorops uses "CRITICAL" string to indicate "Alerting" state

View Source
const AlertStateWarning = "WARNING"

AlertStateWarning - VictorOps "WARNING" message type

Variables

This section is empty.

Functions

func NewAlertmanagerNotifier

NewAlertmanagerNotifier returns a new Alertmanager notifier

func NewEmailNotifier

NewEmailNotifier is the constructor function for the EmailNotifier.

func NewHipChatNotifier

NewHipChatNotifier is the constructor functions for the HipChatNotifier

func NewKafkaNotifier

NewKafkaNotifier is the constructor function for the Kafka notifier.

func NewLINENotifier

NewLINENotifier is the constructor for the LINE notifier

func NewOpsGenieNotifier

NewOpsGenieNotifier is the constructor for OpsGenie.

func NewPagerdutyNotifier

NewPagerdutyNotifier is the constructor for the PagerDuty notifier

func NewPushoverNotifier

NewPushoverNotifier is the constructor for the Pushover Notifier

func NewSensuGoNotifier

NewSensuGoNotifier is the constructor for the Sensu Go Notifier.

func NewSensuNotifier

NewSensuNotifier is the constructor for the Sensu Notifier.

func NewSlackNotifier

NewSlackNotifier is the constructor for the Slack notifier.

func NewTeamsNotifier

NewTeamsNotifier is the constructor for Teams notifier.

func NewTelegramNotifier

NewTelegramNotifier is the constructor for the Telegram notifier

func NewThreemaNotifier

NewThreemaNotifier is the constructor for the Threema notifier

func NewVictoropsNotifier

NewVictoropsNotifier creates an instance of VictoropsNotifier that handles posting notifications to Victorops REST API

func NewWebHookNotifier

NewWebHookNotifier is the constructor for the WebHook notifier.

Types

type AlertmanagerNotifier

type AlertmanagerNotifier struct {
	NotifierBase
	URL               []string
	BasicAuthUser     string
	BasicAuthPassword string
	// contains filtered or unexported fields
}

AlertmanagerNotifier sends alert notifications to the alert manager

func (*AlertmanagerNotifier) Notify

func (am *AlertmanagerNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends alert notifications to the alert manager

func (*AlertmanagerNotifier) ShouldNotify

func (am *AlertmanagerNotifier) ShouldNotify(ctx context.Context, evalContext *alerting.EvalContext, notificationState *models.AlertNotificationState) bool

ShouldNotify returns true if the notifiers should be used depending on state

type DingDingNotifier

type DingDingNotifier struct {
	NotifierBase
	MsgType string
	URL     string
	// contains filtered or unexported fields
}

DingDingNotifier is responsible for sending alert notifications to ding ding.

func (*DingDingNotifier) Notify

func (dd *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends the alert notification to dingding.

type DiscordNotifier

type DiscordNotifier struct {
	NotifierBase
	Content    string
	AvatarURL  string
	WebhookURL string

	UseDiscordUsername bool
	// contains filtered or unexported fields
}

DiscordNotifier is responsible for sending alert notifications to discord.

func (*DiscordNotifier) Notify

func (dn *DiscordNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send an alert notification to Discord.

type EmailNotifier

type EmailNotifier struct {
	NotifierBase
	Addresses   []string
	SingleEmail bool
	// contains filtered or unexported fields
}

EmailNotifier is responsible for sending alert notifications over email.

func (*EmailNotifier) Notify

func (en *EmailNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends the alert notification.

type GoogleChatNotifier

type GoogleChatNotifier struct {
	NotifierBase
	URL string
	// contains filtered or unexported fields
}

GoogleChatNotifier is responsible for sending alert notifications to Google chat.

func (*GoogleChatNotifier) Notify

func (gcn *GoogleChatNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send an alert notification to Google Chat.

type HipChatNotifier

type HipChatNotifier struct {
	NotifierBase
	URL    string
	APIKey string
	RoomID string
	// contains filtered or unexported fields
}

HipChatNotifier is responsible for sending alert notifications to Hipchat.

func (*HipChatNotifier) Notify

func (hc *HipChatNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends an alert notification to HipChat

type KafkaNotifier

type KafkaNotifier struct {
	NotifierBase
	Endpoint string
	Topic    string
	// contains filtered or unexported fields
}

KafkaNotifier is responsible for sending alert notifications to Kafka.

func (*KafkaNotifier) Notify

func (kn *KafkaNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends the alert notification.

type LineNotifier

type LineNotifier struct {
	NotifierBase
	Token string
	// contains filtered or unexported fields
}

LineNotifier is responsible for sending alert notifications to LINE.

func (*LineNotifier) Notify

func (ln *LineNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send an alert notification to LINE

type NotifierBase

type NotifierBase struct {
	Name                  string
	Type                  string
	UID                   string
	IsDefault             bool
	UploadImage           bool
	SendReminder          bool
	DisableResolveMessage bool
	Frequency             time.Duration

	NotificationService notifications.Service
	// contains filtered or unexported fields
}

NotifierBase is the base implementation of a notifier.

func NewNotifierBase

func NewNotifierBase(model *models.AlertNotification, notificationService notifications.Service) NotifierBase

NewNotifierBase returns a new `NotifierBase`.

func (*NotifierBase) GetDisableResolveMessage

func (n *NotifierBase) GetDisableResolveMessage() bool

GetDisableResolveMessage returns true if ok alert notifications should be skipped.

func (*NotifierBase) GetFrequency

func (n *NotifierBase) GetFrequency() time.Duration

GetFrequency returns the frequency for how often alerts should be evaluated.

func (*NotifierBase) GetIsDefault

func (n *NotifierBase) GetIsDefault() bool

GetIsDefault returns true if the notifiers should be used for all alerts.

func (*NotifierBase) GetNotifierUID

func (n *NotifierBase) GetNotifierUID() string

GetNotifierUID returns the notifier `uid`.

func (*NotifierBase) GetSendReminder

func (n *NotifierBase) GetSendReminder() bool

GetSendReminder returns true if reminders should be sent.

func (*NotifierBase) GetType

func (n *NotifierBase) GetType() string

GetType returns the notifier type.

func (*NotifierBase) NeedsImage

func (n *NotifierBase) NeedsImage() bool

NeedsImage returns true if an image is expected in the notification.

func (*NotifierBase) ShouldNotify

func (n *NotifierBase) ShouldNotify(ctx context.Context, context *alerting.EvalContext, notifierState *models.AlertNotificationState) bool

ShouldNotify checks this evaluation should send an alert notification

type OpsGenieNotifier

type OpsGenieNotifier struct {
	NotifierBase
	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 (*OpsGenieNotifier) Notify

func (on *OpsGenieNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends an alert notification to OpsGenie.

type PagerdutyNotifier

type PagerdutyNotifier struct {
	NotifierBase
	Key              string
	Severity         string
	AutoResolve      bool
	MessageInDetails bool
	// contains filtered or unexported fields
}

PagerdutyNotifier is responsible for sending alert notifications to pagerduty

func (*PagerdutyNotifier) Notify

func (pn *PagerdutyNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends an alert notification to PagerDuty

type PushoverNotifier

type PushoverNotifier struct {
	NotifierBase
	UserKey          string
	APIToken         string
	AlertingPriority int
	OKPriority       int
	Retry            int
	Expire           int
	Device           string
	AlertingSound    string
	OKSound          string
	Upload           bool
	// contains filtered or unexported fields
}

PushoverNotifier is responsible for sending alert notifications to Pushover

func (*PushoverNotifier) Notify

func (pn *PushoverNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends a alert notification to Pushover

type SensuGoNotifier

type SensuGoNotifier struct {
	NotifierBase
	URL       string
	Entity    string
	Check     string
	Namespace string
	Handler   string
	APIKey    string
	// contains filtered or unexported fields
}

SensuGoNotifier is responsible for sending alert notifications to Sensu Go.

func (*SensuGoNotifier) Notify

func (sn *SensuGoNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send alert notification to Sensu Go

type SensuNotifier

type SensuNotifier struct {
	NotifierBase
	URL      string
	Source   string
	User     string
	Password string
	Handler  string
	// contains filtered or unexported fields
}

SensuNotifier is responsible for sending alert notifications to Sensu.

func (*SensuNotifier) Notify

func (sn *SensuNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send alert notification to Sensu

type SlackNotifier

type SlackNotifier struct {
	NotifierBase
	// contains filtered or unexported fields
}

SlackNotifier is responsible for sending alert notification to Slack.

func (*SlackNotifier) Notify

func (sn *SlackNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends an alert notification to Slack.

type TeamsNotifier

type TeamsNotifier struct {
	NotifierBase
	URL string
	// contains filtered or unexported fields
}

TeamsNotifier is responsible for sending alert notifications to Microsoft teams.

func (*TeamsNotifier) Notify

func (tn *TeamsNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send an alert notification to Microsoft teams.

type TelegramNotifier

type TelegramNotifier struct {
	NotifierBase
	BotToken    string
	ChatID      string
	UploadImage bool
	// contains filtered or unexported fields
}

TelegramNotifier is responsible for sending alert notifications to Telegram.

func (*TelegramNotifier) Notify

func (tn *TelegramNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send an alert notification to Telegram.

type ThreemaNotifier

type ThreemaNotifier struct {
	NotifierBase
	GatewayID   string
	RecipientID string
	APISecret   string
	// contains filtered or unexported fields
}

ThreemaNotifier is responsible for sending alert notifications to Threema.

func (*ThreemaNotifier) Notify

func (notifier *ThreemaNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send an alert notification to Threema

type VictoropsNotifier

type VictoropsNotifier struct {
	NotifierBase
	URL             string
	NoDataAlertType string
	AutoResolve     bool
	// 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 (*VictoropsNotifier) Notify

func (vn *VictoropsNotifier) Notify(evalContext *alerting.EvalContext) error

Notify sends notification to Victorops via POST to URL endpoint

type WebhookNotifier

type WebhookNotifier struct {
	NotifierBase
	URL        string
	User       string
	Password   string
	HTTPMethod string
	// contains filtered or unexported fields
}

WebhookNotifier is responsible for sending alert notifications as webhooks.

func (*WebhookNotifier) Notify

func (wn *WebhookNotifier) Notify(evalContext *alerting.EvalContext) error

Notify send alert notifications as webhook as http requests.

type WebhookNotifierBody

type WebhookNotifierBody struct {
	Title       string                `json:"title"`
	RuleID      int64                 `json:"ruleId"`
	RuleName    string                `json:"ruleName"`
	State       models.AlertStateType `json:"state"`
	EvalMatches []*alerting.EvalMatch `json:"evalMatches"`
	OrgID       int64                 `json:"orgId"`
	DashboardID int64                 `json:"dashboardId"`
	PanelID     int64                 `json:"panelId"`
	Tags        map[string]string     `json:"tags"`
	RuleURL     string                `json:"ruleUrl,omitempty"`
	ImageURL    string                `json:"imageUrl,omitempty"`
	Message     string                `json:"message,omitempty"`
}

WebhookNotifierBody is the body of webhook notification channel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL