Documentation ¶
Overview ¶
Package monitor implements monitoring logics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrRegistered = errors.New("monitor has already been registered") ErrNotRegistered = errors.New("monitor has not been registered") ErrStarted = errors.New("monitor has already been started") )
Errors for monitors.
Functions ¶
func Unregister ¶
Unregister removes a monitor from the registry. The monitor should have stopped.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is a unit of monitoring.
It consists of a (configured) probe, zero or one filter, and one or more actions. goma will invoke Prover.Probe periodically at given interval.
func FindMonitor ¶
FindMonitor looks up a monitor in the registry. If not found, nil is returned.
func ListMonitors ¶
func ListMonitors() []*Monitor
ListMonitors returns a list of monitors ordered by ID (ascending).
func NewMonitor ¶
func NewMonitor( name string, p probes.Prober, f filters.Filter, a []actions.Actor, interval, timeout time.Duration, min, max float64) *Monitor
NewMonitor creates and initializes a monitor.
name can be any descriptive string for the monitor. p and a should not be nil. f may be nil. interval is the interval between probes. timeout is the maximum duration for a probe to run. min and max defines the range for normal probe results.