Documentation
¶
Overview ¶
Package agenthealth derives the alerts the agent status page shows from what the server already knows: heartbeats, the inventory summary, the agent's jobs and their newest runs, and the server version. It never talks to the agent.
Index ¶
Constants ¶
const StaleAfter = 90 * time.Second
StaleAfter is how long without a heartbeat (sent every 30 s) an agent counts as stale; three missed beats so a single slow request does not flap the status
Variables ¶
This section is empty.
Functions ¶
func EffectiveStatus ¶
EffectiveStatus is the status to display: the stored status unless the heartbeat has gone stale, which makes an "online" agent "offline"
func Stale ¶
Stale reports whether the agent's last heartbeat is older than StaleAfter (or it never sent one)
func VersionBehind ¶ added in v0.14.3
VersionBehind compares two "v1.2.3"-style versions; ok is false when either is not a version (dev builds, empty)
Types ¶
type Alert ¶
type Alert struct {
Level Level `json:"level"`
Title string `json:"title"`
Detail string `json:"detail,omitempty"`
// JobID links the alert to a job when it is about one
JobID *uuid.UUID `json:"job_id,omitempty"`
}
Alert is one finding about an agent
type Input ¶
type Input struct {
Agent *db.Agent
// Jobs are the agent's jobs (jobs for other agents are ignored)
Jobs []*db.BackupJob
// LastRuns maps job id → newest run (from DB.LatestRunByJob); nil = unknown
LastRuns map[uuid.UUID]*db.JobLastRun
// ServerVersion is compared with the agent's version ("dev" disables the check)
ServerVersion string
Now time.Time
}
Input is everything Evaluate looks at