Documentation
¶
Index ¶
- type Monitor
- func (m *Monitor) ResponseTime(ctx context.Context, id string) ([]time.Time, []float64, error)
- func (m *Monitor) Run(ctx context.Context, cfg *types.Cfg) error
- func (m *Monitor) Snapshot(id string) (Snapshot, error)
- func (m *Monitor) Snapshots() []Snapshot
- func (m *Monitor) Stats(ctx context.Context) (*types.Stats, error)
- func (m *Monitor) StatsByID(ctx context.Context, id string, dayReport bool) (*types.Stats, error)
- func (m *Monitor) Stop()
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
Store store.Interface
// CacheTTL - how long the computed stats are cached (0 disables the cache).
// The cache is dropped whenever a check produces a new result.
CacheTTL time.Duration
// contains filtered or unexported fields
}
Monitor - main service which track the hosts liveness
func (*Monitor) ResponseTime ¶
ResponseTime - returns the average response time per day
func (*Monitor) Run ¶
Run - applies the configuration: creates a watcher for every new host, updates the existing ones (restarting only those whose configuration changed) and removes the watchers for hosts that are not in the configuration anymore. The ctx bounds the lifetime of the monitor and is captured on the first call only.
func (*Monitor) Snapshots ¶
Snapshots - returns the current state of every host, ordered as in the configuration
type Snapshot ¶
type Snapshot struct {
Host *types.Host
Status types.StatusType
LastCheck time.Time
LastResponse *types.HttpResponse
}
Snapshot - the current state of a monitored host
Click to show internal directories.
Click to hide internal directories.