Documentation
¶
Overview ¶
Package engine defines the check contract and the runner. A Check produces Findings; the runner executes every registered check with a shared timeout and aggregates results. Output rendering lives in internal/output, so checks stay pure and testable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CertsConfig ¶
type CertsConfig struct {
WarnDays int `yaml:"warn_days"`
CritDays int `yaml:"crit_days"`
// Default port for targets and inventory hosts without an explicit one.
Port int `yaml:"port"`
// Explicit host[:port] targets.
Targets []string `yaml:"targets"`
// Optional Ansible INI inventory: every host becomes a target on Port.
AnsibleInventory string `yaml:"ansible_inventory"`
}
CertsConfig configures the TLS certificate expiry check.
type ChecksConfig ¶
type ChecksConfig struct {
Certs *CertsConfig `yaml:"certs"`
HTTP *HTTPConfig `yaml:"http"`
NATS *NATSConfig `yaml:"nats"`
HAProxy *HAProxyConfig `yaml:"haproxy"`
Stream *StreamConfig `yaml:"stream"`
}
type Config ¶
type Config struct {
TimeoutSeconds int `yaml:"timeout_seconds"`
Checks ChecksConfig `yaml:"checks"`
}
Config is the root of checkfleet.yml.
func LoadConfig ¶
LoadConfig reads and validates checkfleet.yml, applying defaults.
type Finding ¶
type Finding struct {
Check string `json:"check"`
Target string `json:"target"`
Status Status `json:"status"`
Message string `json:"message"`
}
Finding is one observation about one target.
type HAProxyConfig ¶ added in v0.3.0
type HAProxyConfig struct {
// Stats endpoints as host[:port]; Port applies when a target has none.
Targets []string `yaml:"targets"`
Port int `yaml:"port"`
// Scheme (http/https) and path of the CSV stats export.
Scheme string `yaml:"scheme"`
Path string `yaml:"path"`
// Optional Ansible INI inventory: every host becomes a stats target.
AnsibleInventory string `yaml:"ansible_inventory"`
// Optional WARN when a server/backend session usage reaches this percent
// of its limit (scur/slim). 0 disables the check.
SessionWarnPct int `yaml:"session_warn_pct"`
// Optional HTTP basic auth. The password is read from the named env var —
// never store it in the config file.
AuthUser string `yaml:"auth_user"`
AuthPassEnv string `yaml:"auth_pass_env"`
}
HAProxyConfig configures the HAProxy backend/server health check.
type HTTPConfig ¶
type HTTPConfig struct {
Targets []HTTPTarget `yaml:"targets"`
}
HTTPConfig configures the HTTP probe check.
type HTTPTarget ¶
type NATSConfig ¶
type NATSConfig struct {
// Monitoring endpoints as host[:port]; Port applies when a target has none.
Targets []string `yaml:"targets"`
Port int `yaml:"port"`
// Optional Ansible INI inventory: every host becomes a monitoring target.
AnsibleInventory string `yaml:"ansible_inventory"`
// Scheme for the monitoring endpoint (http or https). Default http.
Scheme string `yaml:"scheme"`
// Optional expected meta-leader (server_name); a mismatch is WARN.
ExpectMetaLeader string `yaml:"expect_meta_leader"`
// Optional expected peer set (server_name); unexpected peers are ghosts
// (WARN), missing expected peers are BAD.
ExpectPeers []string `yaml:"expect_peers"`
// Raft peer lag thresholds (entries). WARN/BAD when a peer is at or above.
LagWarn int `yaml:"lag_warn"`
LagCrit int `yaml:"lag_crit"`
}
NATSConfig configures the NATS JetStream cluster health check.
type Result ¶
type Result struct {
Findings []Finding `json:"findings"`
Started time.Time `json:"started"`
Duration time.Duration `json:"duration_ns"`
}
Result aggregates the findings of a run.
type Status ¶
type Status string
Status of a single finding. Severity order: OK < WARN < BAD < ERROR.
type StreamConfig ¶ added in v0.4.0
type StreamConfig struct {
Targets []StreamTarget `yaml:"targets"`
}
StreamConfig configures the HLS/DASH stream health check.
type StreamTarget ¶ added in v0.4.0
type StreamTarget struct {
// Manifest URL: an HLS .m3u8 (master or media) or a DASH .mpd.
URL string `yaml:"url"`
// Optional display label; defaults to the URL.
Name string `yaml:"name"`
// Expected minimum ladder size (variants/representations). 0 disables.
MinVariants int `yaml:"min_variants"`
// Expect a live stream: check live-edge freshness and warn if it's VOD.
Live bool `yaml:"live"`
// Live-edge age thresholds in seconds (WARN/BAD). Applied when Live is set.
MaxAgeWarnSeconds int `yaml:"max_age_warn_seconds"`
MaxAgeCritSeconds int `yaml:"max_age_crit_seconds"`
}