alert

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 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

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

Send 发送警报

func (*AlertData) SendTopic

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

type AlertTopicExt

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

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

type TextContent

type TextContent struct {
}

func (*TextContent) EmailContent

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

func (*TextContent) MarkdownContent

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