notifiers

package
v0.3.9-9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 41 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DingdingMsgTypeLink       = "link"
	DingdingMsgTypeMarkdown   = "markdown"
	DingdingMsgTypeActionCard = "actionCard"
)
View Source
const (
	SUFFIX = "onecloudNotifier"

	MOBILE_DEFAULT_TOPIC_CN = "monitor-cn"
	MOBILE_DEFAULT_TOPIC_EN = "monitor-en"

	MOBILE_METER_TOPIC_CN = "meter-cn"
	MOBILE_METER_TOPIC_EN = "meter-en"
)

Variables

This section is empty.

Functions

func DecodeBasicAuthHeader

func DecodeBasicAuthHeader(header string) (string, string, error)

DecodeBasicAuthHeader decodes user and password from a basic auth header.

func GetBasicAuthHeader

func GetBasicAuthHeader(user string, password string) string

GetBasicAuthHeader returns a base64 encoded string from user and password.

func GetUserLangIdsMap

func GetUserLangIdsMap(ids []string) (map[string][]string, error)

func SendNotifyInfo

func SendNotifyInfo(base *sendnotifyBase, imp Isendnotify) error

func SendWebRequestSync

func SendWebRequestSync(ctx context.Context, webhook *monitor.SendWebhookSync) error

Types

type AutoScalingNotifier

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

func (*AutoScalingNotifier) Notify

func (*AutoScalingNotifier) ShouldNotify

func (as *AutoScalingNotifier) ShouldNotify(ctx context.Context, evalContext *alerting.EvalContext,
	notificationState *models.SAlertnotification) bool

type DingDingNotifier

type DingDingNotifier struct {
	NotifierBase
	MsgType string
	Url     string
}

func (*DingDingNotifier) Notify

type FeishuNotifier

type FeishuNotifier struct {
	NotifierBase
	// Settings *monitor.NotificationSettingFeishu
	Client  *feishu.Tenant
	ChatIds []string
}

func (*FeishuNotifier) Notify

type Isendnotify

type Isendnotify interface {
	// contains filtered or unexported methods
}

type NotifierBase

type NotifierBase struct {
	Ctx                   context.Context
	Name                  string
	Type                  string
	Id                    string
	IsDefault             bool
	SendReminder          bool
	DisableResolveMessage bool
	Frequency             time.Duration
}

NotifierBase is the base implentation of a notifier

func NewNotifierBase

func NewNotifierBase(config alerting.NotificationConfig) 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) GetNotifierId

func (n *NotifierBase) GetNotifierId() string

GetNotifierId 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) ShouldNotify

func (n *NotifierBase) ShouldNotify(_ context.Context, evalCtx *alerting.EvalContext, state *models.SAlertnotification) bool

ShouldNotify checks this evaluation should send an alert notification

type OneCloudNotifier

type OneCloudNotifier struct {
	NotifierBase
	Setting *monitor.NotificationSettingOneCloud
	// contains filtered or unexported fields
}

OneCloudNotifier is responsible for sending alert notifications over onecloud notify service.

func (*OneCloudNotifier) Notify

Notify sends the alert notification.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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