Documentation
¶
Overview ¶
Package agent is beacon-probe's push mode, the whole probe agent in one process: every interval it fetches what to check from the gateway (its targets and the module file, cached on disk for when the gateway cannot be reached), probes every target, reads the host's metrics and heartbeats, and pushes it all to the gateway in the Prometheus text format with timestamps. When a push fails, the batch waits in a queue on disk and goes first next time, so a probe that loses its path to the gateway fills the gap when the path comes back. The queue has a size limit; the oldest batches go first.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent runs the cycle, and beside it the poll for requests to probe on demand (requests.go).
func (*Agent) Run ¶
Run runs a cycle every interval until ctx ends, starting at once, and polls for requests to probe on demand beside it; it returns once both have stopped. Between cycles it wakes for the targets whose groups ask to be checked more often than every cycle (Group.IntervalSeconds), probes those that are due and pushes what they found.
type Config ¶
type Config struct {
Gateway string // such as https://metrics.example.com
Token string
StateDir string // cache and queue
Interval time.Duration
Parallel int // probes at once
MaxQueue int64 // bytes on disk
Prober *probe.Prober
Host *hostmetrics.Collector
HTTP *http.Client
Log *slog.Logger
Now func() time.Time
}
Config is the agent's setup.