alert

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIXED = 1 + iota
	THRESHOLD
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertEventListener

type AlertEventListener interface {
	OnAlert(n *AlertMessage)
}

type AlertManager

type AlertManager struct {
	graph.DefaultGraphListener
	Graph        *graph.Graph
	AlertHandler api.ApiHandler
	// contains filtered or unexported fields
}

func NewAlertManager

func NewAlertManager(g *graph.Graph, ah api.ApiHandler) *AlertManager

func (*AlertManager) AddEventListener

func (a *AlertManager) AddEventListener(l AlertEventListener)

func (*AlertManager) DelEventListener

func (a *AlertManager) DelEventListener(l AlertEventListener)

func (*AlertManager) DeleteAlert

func (a *AlertManager) DeleteAlert(id string)

func (*AlertManager) EvalNodes

func (a *AlertManager) EvalNodes()

func (*AlertManager) OnNodeAdded

func (a *AlertManager) OnNodeAdded(n *graph.Node)

func (*AlertManager) OnNodeUpdated

func (a *AlertManager) OnNodeUpdated(n *graph.Node)

func (*AlertManager) SetAlert

func (a *AlertManager) SetAlert(at *api.Alert)

func (*AlertManager) Start

func (a *AlertManager) Start()

func (*AlertManager) Stop

func (a *AlertManager) Stop()

type AlertMessage

type AlertMessage struct {
	UUID       string
	Type       int
	Timestamp  time.Time
	Count      int
	Reason     string
	ReasonData interface{}
}

func (*AlertMessage) Marshal

func (am *AlertMessage) Marshal() []byte

func (*AlertMessage) String

func (am *AlertMessage) String() string

type Server

type Server struct {
	AlertManager *AlertManager

	Host string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(a *AlertManager, server *shttp.Server, pongWait time.Duration) *Server

func NewServerFromConfig

func NewServerFromConfig(a *AlertManager, server *shttp.Server) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

func (*Server) Stop

func (s *Server) Stop()

type WSClient

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

func (*WSClient) OnAlert

func (c *WSClient) OnAlert(amsg *AlertMessage)

Called by alert.EvalNodes()

type WSServer

type WSServer struct {
	AlertManager *AlertManager
	// contains filtered or unexported fields
}

func (*WSServer) ListenAndServe

func (s *WSServer) ListenAndServe()

Jump to

Keyboard shortcuts

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