alert

package
v0.0.0-...-0248c43 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(creater AlerterCreater)

Register 注册一个AlerterCreater

Types

type Alerter

type Alerter interface {
	// Alert 根据结果报警
	Alert(res map[string]interface{}) error
}

Alerter 报警方式处理接口

func CreateAlerter

func CreateAlerter(alertConfig map[string]interface{}) (Alerter, error)

CreateAlerter 根据type生成一个Alerter

type AlerterCreater

type AlerterCreater interface {
	GetTypes() []string
	// Create 根据config生成一个alert
	GetAlerter(alertConfig map[string]interface{}) (interface{}, error)
}

AlerterCreater 产生者 将产生逻辑规定到Alert的出生地

func GetCreater

func GetCreater(t string) (AlerterCreater, error)

GetCreater 获取一个AlerterCreater

type ConfigError

type ConfigError struct {
	Message string
}

ConfigError 配置错误

func (ConfigError) Error

func (configError ConfigError) Error() string

type HTTPAlert

type HTTPAlert struct {
	Url string
}

HTTPAlert http 报警方式

func (HTTPAlert) Alert

func (httpAlert HTTPAlert) Alert(res map[string]interface{}) error

Alert 发送http请求

func (HTTPAlert) GetAlerter

func (HTTPAlert) GetAlerter(alertConfig map[string]interface{}) (alert interface{}, err error)

Create 。。。

func (HTTPAlert) GetTypes

func (httpAlert HTTPAlert) GetTypes() []string

type LogAlert

type LogAlert struct {
}

LogAlert 打印日志报警方式,默认报警方式,当没有任何报警方式时,自动添加该报警方式

func (LogAlert) Alert

func (LogAlert) Alert(res map[string]interface{}) error

Alert 打印日志记录

func (LogAlert) GetAlerter

func (LogAlert) GetAlerter(map[string]interface{}) (interface{}, error)

Create 。。。

func (LogAlert) GetTypes

func (LogAlert) GetTypes() []string

type MailAlert

type MailAlert struct {
	Mail    util.Mail
	To      []string
	Subject string
	Content string
	// contains filtered or unexported fields
}

MailAlert 发送邮件报警方式

func (MailAlert) Alert

func (mailAlert MailAlert) Alert(res map[string]interface{}) error

Alert 发送邮件

func (MailAlert) GetAlerter

func (MailAlert) GetAlerter(alertConfig map[string]interface{}) (alert interface{}, err error)

Create 。。。

func (MailAlert) GetTypes

func (mailAlert MailAlert) GetTypes() []string

type NotFoundError

type NotFoundError struct {
	Message string
}

func (NotFoundError) Error

func (notFoundError NotFoundError) Error() string

Jump to

Keyboard shortcuts

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