sender

package
v6.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Recovered = "recovered"
	Triggered = "triggered"
)

Variables

This section is empty.

Functions

func InitEmailSender added in v6.0.3

func InitEmailSender(smtp aconf.SMTPConfig)

func MapStrToStr

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

func MayPluginNotify

func MayPluginNotify(noticeBytes []byte, notifyScript models.NotifyScript, stats *astats.Stats)

func RestartEmailSender

func RestartEmailSender(smtp aconf.SMTPConfig)

func SendCallbacks

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

func SendEmail added in v6.0.3

func SendEmail(subject, content string, tos []string, stmp aconf.SMTPConfig) error

func SendMM

func SendMM(message MatterMostMessage)

func SendTelegram

func SendTelegram(message TelegramMessage)

func SendWebhooks

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

Types

type BuildTplMessageFunc

type BuildTplMessageFunc func(channel string, tpl *template.Template, events []*models.AlertCurEvent) string
var BuildTplMessage BuildTplMessageFunc = buildTplMessage

type Cards

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

type Conf

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

type DingtalkSender

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

func (*DingtalkSender) Send

func (ds *DingtalkSender) Send(ctx MessageContext)

type Element

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

type EmailSender

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

func (*EmailSender) Send

func (es *EmailSender) Send(ctx MessageContext)

func (*EmailSender) WriteEmail

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

type FeishuCardSender

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

func (*FeishuCardSender) Send

func (fs *FeishuCardSender) Send(ctx MessageContext)

type FeishuSender

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

func (*FeishuSender) Send

func (fs *FeishuSender) Send(ctx MessageContext)

type Headers

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

type MatterMostMessage

type MatterMostMessage struct {
	Text   string
	Tokens []string
	Stats  *astats.Stats
}

type MessageContext

type MessageContext struct {
	Users  []*models.User
	Rule   *models.AlertRule
	Events []*models.AlertCurEvent
	Stats  *astats.Stats
}

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

func BuildMessageContext

func BuildMessageContext(rule *models.AlertRule, events []*models.AlertCurEvent, uids []int64, userCache *memsto.UserCacheType, stats *astats.Stats) 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"`
	Stdin     string   `json:"stdin"`
	Action    string   `json:"action"`
	Creator   string   `json:"creator"`
	Hosts     []string `json:"hosts"`
}

type Te

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

type TelegramMessage

type TelegramMessage struct {
	Text   string
	Tokens []string
	Stats  *astats.Stats
}

type TelegramSender

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

func (*TelegramSender) Send

func (ts *TelegramSender) Send(ctx MessageContext)

type Titles

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

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