Documentation ¶
Index ¶
- Constants
- func DecodeBasicAuthHeader(header string) (string, string, error)
- func GetBasicAuthHeader(user string, password string) string
- func GetNotifyTemplateConfig(ctx *alerting.EvalContext, isRecoverd bool, matches []*monitor.EvalMatch) monitor.NotificationTemplateConfig
- func GetUserLangIdsMap(ids []string) (map[string][]string, error)
- func SendNotifyInfo(base *sendnotifyBase, imp Isendnotify) error
- func SendWebRequestSync(ctx context.Context, webhook *monitor.SendWebhookSync) error
- type AutoScalingNotifier
- type DingDingNotifier
- type FeishuNotifier
- type Isendnotify
- type NotifierBase
- func (n *NotifierBase) GetDisableResolveMessage() bool
- func (n *NotifierBase) GetFrequency() time.Duration
- func (n *NotifierBase) GetNotifierId() string
- func (n *NotifierBase) GetSendReminder() bool
- func (n *NotifierBase) GetType() string
- func (n *NotifierBase) ShouldNotify(_ context.Context, evalCtx *alerting.EvalContext, ...) bool
- type OneCloudNotifier
Constants ¶
const ( DingdingMsgTypeLink = "link" DingdingMsgTypeMarkdown = "markdown" DingdingMsgTypeActionCard = "actionCard" )
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 ¶
DecodeBasicAuthHeader decodes user and password from a basic auth header.
func GetBasicAuthHeader ¶
GetBasicAuthHeader returns a base64 encoded string from user and password.
func GetNotifyTemplateConfig ¶
func GetNotifyTemplateConfig(ctx *alerting.EvalContext, isRecoverd bool, matches []*monitor.EvalMatch) monitor.NotificationTemplateConfig
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 (as *AutoScalingNotifier) Notify(ctx *alerting.EvalContext, data jsonutils.JSONObject) error
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 ¶
func (dd *DingDingNotifier) Notify(evalCtx *alerting.EvalContext, d jsonutils.JSONObject) error
type FeishuNotifier ¶
type FeishuNotifier struct { NotifierBase // Settings *monitor.NotificationSettingFeishu Client *feishu.Tenant ChatIds []string }
func (*FeishuNotifier) Notify ¶
func (fs *FeishuNotifier) Notify(ctx *alerting.EvalContext, _ jsonutils.JSONObject) error
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 ¶
func (oc *OneCloudNotifier) Notify(ctx *alerting.EvalContext, _ jsonutils.JSONObject) error
Notify sends the alert notification.