alarm

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUrl         = errors.New("invalid url")
	ErrAlarmerBusy        = errors.New("alarmer busy")
	ErrUnExpectedResponse = errors.New("unexpected http response")
)

Functions

This section is empty.

Types

type Alarm

type Alarm interface {
	Alarm(clusterId uint64, kind AlarmKind, title, content string) error
	Stop()
}

func NewLocalAlarm

func NewLocalAlarm() Alarm

type AlarmKind

type AlarmKind int
const (
	Invalid AlarmKind = iota
	// 任务报警
	TaskAlarm
	// 运行时报警,一般是系统出现严重的bug
	RuntimeAlarm
	// 系统报警,系统错误报警
	SysAlarm
	// 资源报警
	ResourceAlarm
)

type AlarmMessage

type AlarmMessage struct {
	Title   string
	Content string
	MailTo  string
	SmsTo   string
}

type AlarmMsg

type AlarmMsg struct {
	Email []*EmailMsg `json:"email"`
	Sms   []*SmsMsg   `json:"sms"`
}

type EmailMsg

type EmailMsg struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	To      string `json:"to"`
}

type LocalAlarm

type LocalAlarm struct {
}

func (*LocalAlarm) Alarm

func (l *LocalAlarm) Alarm(clusterId uint64, kind AlarmKind, title, content string) error

func (*LocalAlarm) Stop

func (l *LocalAlarm) Stop()

type RemoteAlarm

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

func NewRemoteAlarm

func NewRemoteAlarm(clusterId uint64, url, mailTo, smsTo string) *RemoteAlarm

func (*RemoteAlarm) Alarm

func (a *RemoteAlarm) Alarm(clusterId uint64, kind AlarmKind, title, content string) error

func (*RemoteAlarm) Stop

func (a *RemoteAlarm) Stop()

type SmsMsg

type SmsMsg struct {
	Content string `json:"content"`
	To      string `json:"to"`
}

Jump to

Keyboard shortcuts

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