Validator agent: retry outbound HTTPS up to 3 times, traceroute on failure
A failed HTTPS check is retried (3 attempts, 2 s apart). If all attempts fail, the agent runs traceroute -4 -n to the target's IPv4 address in a separate process, polls it every 5 s (90 s limit) and posts the full output as a traceroute_result event for the address. The agent waits for traces before reporting completion, while the floating IP is attached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1536723196
commit
5c75ece8b1
15 files changed
+480
-25
No files matched your search
@@ -265,8 +265,26 @@ type AgentChecks struct {
|
||||
ICMPTimeoutSeconds int `yaml:"icmp_timeout_seconds"`
|
||||
ICMPCount int `yaml:"icmp_count"`
|
||||
SSH SSHCfg `yaml:"ssh"`
|
||||
|
||||
// HTTPSAttempts is the number of tries per HTTPS URL (first + retries).
|
||||
HTTPSAttempts int `yaml:"https_attempts"`
|
||||
HTTPSRetryDelaySeconds int `yaml:"https_retry_delay_seconds"`
|
||||
|
||||
Traceroute TracerouteCfg `yaml:"traceroute"`
|
||||
}
|
||||
|
||||
// TracerouteCfg controls the background traceroute run after a failed HTTPS
|
||||
// check. Enabled is a pointer so that an absent key means "enabled".
|
||||
type TracerouteCfg struct {
|
||||
Enabled *bool `yaml:"enabled"`
|
||||
TimeoutSeconds int `yaml:"timeout_seconds"`
|
||||
MaxHops int `yaml:"max_hops"`
|
||||
PollIntervalSeconds int `yaml:"poll_interval_seconds"`
|
||||
}
|
||||
|
||||
// IsEnabled reports whether traceroute is on (default true).
|
||||
func (t TracerouteCfg) IsEnabled() bool { return t.Enabled == nil || *t.Enabled }
|
||||
|
||||
type SSHCfg struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
TimeoutSeconds int `yaml:"timeout_seconds"`
|
||||
@@ -306,6 +324,21 @@ func LoadValidatorAgent(path string) (*ValidatorAgent, error) {
|
||||
if c.Checks.ICMPCount == 0 {
|
||||
c.Checks.ICMPCount = 3
|
||||
}
|
||||
if c.Checks.HTTPSAttempts <= 0 {
|
||||
c.Checks.HTTPSAttempts = 3
|
||||
}
|
||||
if c.Checks.HTTPSRetryDelaySeconds <= 0 {
|
||||
c.Checks.HTTPSRetryDelaySeconds = 2
|
||||
}
|
||||
if c.Checks.Traceroute.TimeoutSeconds <= 0 {
|
||||
c.Checks.Traceroute.TimeoutSeconds = 90
|
||||
}
|
||||
if c.Checks.Traceroute.MaxHops <= 0 {
|
||||
c.Checks.Traceroute.MaxHops = 30
|
||||
}
|
||||
if c.Checks.Traceroute.PollIntervalSeconds <= 0 {
|
||||
c.Checks.Traceroute.PollIntervalSeconds = 5
|
||||
}
|
||||
if c.Checks.SSH.TimeoutSeconds == 0 {
|
||||
c.Checks.SSH.TimeoutSeconds = 5
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user