sender

package
v5.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTplMessage added in v5.15.0

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

func MapStrToStr added in v5.11.2

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

func MayPluginNotify added in v5.15.0

func MayPluginNotify(noticeBytes []byte)

func PublishToRedis added in v5.15.0

func PublishToRedis(clusterName string, bs []byte)

func SendCallbacks added in v5.15.0

func SendCallbacks(urls []string, event *models.AlertCurEvent)

func SendEmail

func SendEmail(subject, content string, tos []string)

func SendMM added in v5.11.2

func SendMM(message MatterMostMessage)

func SendTelegram added in v5.14.3

func SendTelegram(message TelegramMessage)

func SendWebhooks added in v5.15.0

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

func StartEmailSender

func StartEmailSender()

func WriteEmail

func WriteEmail(subject, content string, tos []string)

Types

type Cards added in v5.15.1

type Cards struct {
	Config   Conf      `json:"config"`
	Elements []Element `json:"elements"`
	Header   Headers   `json:"header"`
}

type Conf added in v5.15.1

type Conf struct {
	WideScreenMode bool `json:"wide_screen_mode"`
	EnableForward  bool `json:"enable_forward"`
}

type DingtalkSender added in v5.15.0

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

func (*DingtalkSender) Send added in v5.15.0

func (ds *DingtalkSender) Send(ctx MessageContext)

func (*DingtalkSender) SendRaw added in v5.15.0

func (ds *DingtalkSender) SendRaw(users []*models.User, title, message string)

type Element added in v5.15.1

type Element struct {
	Tag      string    `json:"tag"`
	Text     Te        `json:"text"`
	Content  string    `json:"content"`
	Elements []Element `json:"elements"`
}

type EmailSender added in v5.15.0

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

func (*EmailSender) Send added in v5.15.0

func (es *EmailSender) Send(ctx MessageContext)

func (*EmailSender) SendRaw added in v5.15.0

func (es *EmailSender) SendRaw(users []*models.User, title, message string)

type FeishuCardSender added in v5.15.1

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

func (*FeishuCardSender) Send added in v5.15.1

func (fs *FeishuCardSender) Send(ctx MessageContext)

func (*FeishuCardSender) SendRaw added in v5.15.1

func (fs *FeishuCardSender) SendRaw(users []*models.User, title, message string)

type FeishuSender added in v5.15.0

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

func (*FeishuSender) Send added in v5.15.0

func (fs *FeishuSender) Send(ctx MessageContext)

func (*FeishuSender) SendRaw added in v5.15.0

func (fs *FeishuSender) SendRaw(users []*models.User, title, message string)

type Headers added in v5.15.1

type Headers struct {
	Title    Titles `json:"title"`
	Template string `json:"template"`
}

type MatterMostMessage added in v5.11.2

type MatterMostMessage struct {
	Text   string
	Tokens []string
}

type MessageContext added in v5.15.0

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

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

func BuildMessageContext added in v5.15.0

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

type MmSender added in v5.15.0

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

func (*MmSender) Send added in v5.15.0

func (ms *MmSender) Send(ctx MessageContext)

func (*MmSender) SendRaw added in v5.15.0

func (ms *MmSender) SendRaw(users []*models.User, title, message string)

type Sender added in v5.15.0

type Sender interface {
	Send(ctx MessageContext)

	// SendRaw 发送原始消息,目前在notifyMaintainer时使用
	SendRaw(users []*models.User, title, message string)
}

Sender 发送消息通知的接口

func NewSender added in v5.15.0

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

type TaskCreateReply added in v5.15.0

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

type TaskForm added in v5.15.0

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 Te added in v5.15.1

type Te struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type TelegramMessage added in v5.14.3

type TelegramMessage struct {
	Text   string
	Tokens []string
}

type TelegramSender added in v5.15.0

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

func (*TelegramSender) Send added in v5.15.0

func (ts *TelegramSender) Send(ctx MessageContext)

func (*TelegramSender) SendRaw added in v5.15.0

func (ts *TelegramSender) SendRaw(users []*models.User, title, message string)

type Titles added in v5.15.1

type Titles struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type WecomSender added in v5.15.0

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

func (*WecomSender) Send added in v5.15.0

func (ws *WecomSender) Send(ctx MessageContext)

func (*WecomSender) SendRaw added in v5.15.0

func (ws *WecomSender) SendRaw(users []*models.User, title, message string)

Jump to

Keyboard shortcuts

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