sender

package
v6.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTplMessage

func BuildTplMessage(tpl *template.Template, event *models.AlertCurEvent) string

func MapStrToStr

func MapStrToStr(arr []string, fn func(s string) string) []string

func MayPluginNotify

func MayPluginNotify(noticeBytes []byte, notifyScript models.NotifyScript)

func RestartEmailSender

func RestartEmailSender(smtp aconf.SMTPConfig)

func SendCallbacks

func SendCallbacks(ctx *ctx.Context, urls []string, event *models.AlertCurEvent, targetCache *memsto.TargetCacheType, ibexConf aconf.Ibex)

func SendMM

func SendMM(message MatterMostMessage)

func SendTelegram

func SendTelegram(message TelegramMessage)

func SendWebhooks

func SendWebhooks(webhooks []*models.Webhook, event *models.AlertCurEvent)

func StartEmailSender

func StartEmailSender(smtp aconf.SMTPConfig)

Types

type DingtalkSender

type DingtalkSender struct {
	// contains filtered or unexported fields
}

func (*DingtalkSender) Send

func (ds *DingtalkSender) Send(ctx MessageContext)

type EmailSender

type EmailSender struct {
	// contains filtered or unexported fields
}

func (*EmailSender) Send

func (es *EmailSender) Send(ctx MessageContext)

func (*EmailSender) SendEmail

func (es *EmailSender) SendEmail(subject, content string, tos []string, stmp aconf.SMTPConfig)

func (*EmailSender) WriteEmail

func (es *EmailSender) WriteEmail(subject, content string, tos []string)

type FeishuSender

type FeishuSender struct {
	// contains filtered or unexported fields
}

func (*FeishuSender) Send

func (fs *FeishuSender) Send(ctx MessageContext)

type MatterMostMessage

type MatterMostMessage struct {
	Text   string
	Tokens []string
}

type MessageContext

type MessageContext struct {
	Users []*models.User
	Rule  *models.AlertRule
	Event *models.AlertCurEvent
}

MessageContext 一个event所生成的告警通知的上下文

func BuildMessageContext

func BuildMessageContext(rule *models.AlertRule, event *models.AlertCurEvent, uids []int64, userCache *memsto.UserCacheType) MessageContext

type MmSender

type MmSender struct {
	// contains filtered or unexported fields
}

func (*MmSender) Send

func (ms *MmSender) Send(ctx MessageContext)

type Sender

type Sender interface {
	Send(ctx MessageContext)
}

Sender 发送消息通知的接口

func NewSender

func NewSender(key string, tpls map[string]*template.Template, smtp aconf.SMTPConfig) Sender

type TaskCreateReply

type TaskCreateReply struct {
	Err string `json:"err"`
	Dat int64  `json:"dat"` // task.id
}

type TaskForm

type TaskForm struct {
	Title     string   `json:"title"`
	Account   string   `json:"account"`
	Batch     int      `json:"batch"`
	Tolerance int      `json:"tolerance"`
	Timeout   int      `json:"timeout"`
	Pause     string   `json:"pause"`
	Script    string   `json:"script"`
	Args      string   `json:"args"`
	Action    string   `json:"action"`
	Creator   string   `json:"creator"`
	Hosts     []string `json:"hosts"`
}

type TelegramMessage

type TelegramMessage struct {
	Text   string
	Tokens []string
}

type TelegramSender

type TelegramSender struct {
	// contains filtered or unexported fields
}

func (*TelegramSender) Send

func (ts *TelegramSender) Send(ctx MessageContext)

type WecomSender

type WecomSender struct {
	// contains filtered or unexported fields
}

func (*WecomSender) Send

func (ws *WecomSender) Send(ctx MessageContext)

Jump to

Keyboard shortcuts

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