alert

package
v5.3.3-pre24 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RecipientTypes 收信类型
	RecipientTypes = echo.NewKVData()

	// RecipientPlatforms 收信平台
	RecipientPlatforms             = echo.NewKVData()
	RecipientPlatformWebhookCustom = `custom`

	// Topics 告警专题
	Topics = echo.NewKVData()
)
View Source
var DefaultTextContent = &TextContent{}

Functions

func SendTopic

func SendTopic(c echo.Context, topic string, a *AlertData) error

Types

type AlertData

type AlertData struct {
	Title   string
	Content ContentType
	Data    param.Store
}

func NewData

func NewData(title string, ct ContentType) *AlertData

func (*AlertData) Send added in v5.1.2

func (alertData *AlertData) Send(a *dbschema.NgingAlertRecipient) (err error)

Send 发送警报

func (*AlertData) SendTopic added in v5.1.2

func (alertData *AlertData) SendTopic(ctx echo.Context, topic string) (err error)

type AlertTopicExt added in v5.1.2

type AlertTopicExt struct {
	*dbschema.NgingAlertTopic
	Recipient *dbschema.NgingAlertRecipient `db:"-,relation=id:recipient_id"`
}

type ContentType

type ContentType interface {
	EmailContent(params param.Store) []byte
	MarkdownContent(params param.Store) []byte
}

ContentType 消息内容类型

type TagValues added in v5.1.2

type TagValues interface {
	TagValues() map[string]string
}

type TextContent added in v5.1.2

type TextContent struct {
}

func (*TextContent) EmailContent added in v5.1.2

func (c *TextContent) EmailContent(params param.Store) []byte

func (*TextContent) MarkdownContent added in v5.1.2

func (c *TextContent) MarkdownContent(params param.Store) []byte

type WebhookCustom

type WebhookCustom struct {
	Name    string
	Method  string
	Url     string
	Content string
	Headers []string
}

func NewWebhookCustom

func NewWebhookCustom() *WebhookCustom

func (*WebhookCustom) Descriptions

func (w *WebhookCustom) Descriptions() []string

func (*WebhookCustom) ToWebhook

func (w *WebhookCustom) ToWebhook() *webhook.Webhook

Jump to

Keyboard shortcuts

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