alarm

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MESSAGE_LEVEL_INFO = iota
	MESSAGE_LEVEL_WARN
	MESSAGE_LEVEL_ERROR
)
View Source
const (
	MESSAGEGATEWAY_WAIT_QUEUE_LENGTH = 10000
)

Variables

This section is empty.

Functions

func NewClusterIdFilter

func NewClusterIdFilter(ids []int64) *clusterIdFilter

func SamplesToJson added in v0.6.3

func SamplesToJson(samples []*Sample) []string

Types

type AlarmClient

type AlarmClient interface {
	TaskTimeoutAlarm(clusterId int64, timeoutAlarm *alarmpb.TaskTimeout, task *taskpb.Task, desc string, samples []*Sample) error
	TaskLongTimeRunningAlarm(clusterId int64, longTimeRunningAlarm *alarmpb.TaskLongTimeRunning, task *taskpb.Task, desc string, samples []*Sample) error
	RangeNoHeartbeatAlarm(clusterId int64, rangeNoHbAlarm *alarmpb.RangeNoHeartbeatAlarm, desc string, samples []*Sample) error
	NodeNoHeartbeatAlarm(clusterId int64, nodeNoHbAlarm *alarmpb.NodeNoHeartbeatAlarm, desc string, samples []*Sample) error
	NodeDiskSizeAlarm(clusterId int64, nodeDiskSizeAlarm *alarmpb.NodeDiskSizeAlarm, desc string, samples []*Sample) error
	NodeLeaderCountAlarm(clusterId int64, nodeLeaderCountAlarm *alarmpb.NodeLeaderCountAlarm, desc string, samples []*Sample) error
	SimpleAlarm(clusterId uint64, title, content string, samples []*Sample) error
	Close()
}

type Client

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

func NewAlarmClient

func NewAlarmClient(addr string) (*Client, error)

func (*Client) AliveAlarm

func (c *Client) AliveAlarm() error

func (*Client) Close

func (c *Client) Close()

func (*Client) NodeDiskSizeAlarm

func (c *Client) NodeDiskSizeAlarm(clusterId int64, nodeDiskSizeAlarm *alarmpb.NodeDiskSizeAlarm, desc string, samples []*Sample) error

func (*Client) NodeLeaderCountAlarm

func (c *Client) NodeLeaderCountAlarm(clusterId int64, nodeLeaderCountAlarm *alarmpb.NodeLeaderCountAlarm, desc string, samples []*Sample) error

func (*Client) NodeNoHeartbeatAlarm

func (c *Client) NodeNoHeartbeatAlarm(clusterId int64, nodeNoHbAlarm *alarmpb.NodeNoHeartbeatAlarm, desc string, samples []*Sample) error

func (*Client) RangeNoHeartbeatAlarm

func (c *Client) RangeNoHeartbeatAlarm(clusterId int64, rangeNoHbAlarm *alarmpb.RangeNoHeartbeatAlarm, desc string, samples []*Sample) error

func (*Client) SimpleAlarm

func (c *Client) SimpleAlarm(clusterId uint64, title, content string, samples []*Sample) error

func (*Client) TaskLongTimeRunningAlarm

func (c *Client) TaskLongTimeRunningAlarm(clusterId int64, longTimeRunningAlarm *alarmpb.TaskLongTimeRunning, task *taskpb.Task, desc string, samples []*Sample) error

func (*Client) TaskTimeoutAlarm

func (c *Client) TaskTimeoutAlarm(clusterId int64, timeoutAlarm *alarmpb.TaskTimeout, task *taskpb.Task, desc string, samples []*Sample) error

type Message

type Message struct {
	ClusterId int64
	Title     string
	Content   string
	Level     int
	// contains filtered or unexported fields
}

type MessageGateway

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

func NewMessageGateway

func NewMessageGateway(ctx context.Context, addr, alarmServerAddr string, receiver MessageReceiver) *MessageGateway

func (*MessageGateway) PushSampleJson added in v0.6.3

func (gw *MessageGateway) PushSampleJson(sample string) error

type MessageReceiver

type MessageReceiver interface {
	GetMailList(clusterId int64, messageLevel int) []string
	GetSmsList(clusterId int64, messageLevel int) []string
}

type MessageTo

type MessageTo struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	MailTo  string `json:"mailTo"`
	SmsTo   string `json:"smsTo"`
}

type Sample added in v0.6.3

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

func NewSample added in v0.6.3

func NewSample(ip string, port int, spaceId int, info map[string]interface{}) *Sample

func (*Sample) ToJson added in v0.6.3

func (sample *Sample) ToJson() string

type Server

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

func NewAlarmServer

func NewAlarmServer(ctx context.Context, port int, gatewayAddress, remoteAlarmServerAddress string, receiver MessageReceiver) (*Server, error)

func (*Server) AliveAlarm

func (s *Server) AliveAlarm(ctx context.Context, req *alarmpb.AliveRequest) (*alarmpb.AliveResponse, error)

func (*Server) NodeRangeAlarm

func (*Server) SimpleAlarm

func (s *Server) SimpleAlarm(ctx context.Context, req *alarmpb.SimpleRequest) (*alarmpb.SimpleResponse, error)

func (*Server) TaskAlarm

type SimpleReceiver

type SimpleReceiver struct {
	Users []*User
}

func NewSimpleReceiver

func NewSimpleReceiver(users []*User) *SimpleReceiver

func (*SimpleReceiver) GetMailList

func (r *SimpleReceiver) GetMailList(id int64, level int) (ret []string)

func (*SimpleReceiver) GetSmsList

func (r *SimpleReceiver) GetSmsList(id int64, level int) (ret []string)

type User

type User struct {
	Name string
	Mail string
	Sms  string
}

Jump to

Keyboard shortcuts

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