Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostStatus ¶
HostStatus is a wrap around a host (name or IP), the host status represented by Down, and the reason why it's down. The status is used as initial state when monitoring starts and a event information when a host goes up or down.
type Loader ¶
type Loader func(chan<- HostStatus)
Loader is a function which takes 1 channel of Host(s) where it should insert Host(s) that should be monitored this function will run at boot time to load an initial list of Host(s)
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is the main structure that represent a monitored host Whenever a host goes up or down it notifies it on the corresponding channel
func NewMonitor ¶
func NewMonitor(status HostStatus, ping PingFunc, notifyCh chan<- HostStatus) *Monitor
NewMonitor takes a host, an initial state, and the notification channels and returns a monitorable host structure
type Notifier ¶
type Notifier func(<-chan HostStatus)
Notifier is a function which takes 1 channel of Host(s) where it all hosts that went throw an UP or DOWN status change.
type Pool ¶
type Pool struct { Ping PingFunc Interval time.Duration FailLimit int Receive Receiver Notify Notifier Load Loader // contains filtered or unexported fields }
Pool is the structure that wraps the list of Host(s) that are being monitored, with the monitoring parameters and the functions interfacing with the rest of the system.
type Receiver ¶
type Receiver func(chan<- HostStatus, chan<- HostStatus)
Receiver is a functions which takes 2 channels of Host in the first ones inserts Host(s) that should be monitored in the second one Host(s) that should stop being monitored