Documentation ¶
Index ¶
- Constants
- Variables
- func GetTOLoginDispersion(pollingInterval time.Duration, dispersionFactor int) time.Duration
- func LoadConfig(cfg *Cfg) (bool, error)
- func NewCfgPtr(cfg *Cfg) *util.AtomicPtr[Cfg]
- func ReadCredentials(cfg *Cfg, updating bool) error
- func Usage()
- type Cfg
- type HealthMethod
- type LogCfg
Constants ¶
View Source
const ( DefaultPollStateJSONLog = "/var/log/trafficcontrol/poll-state.json" DefaultConfigFile = "/etc/trafficcontrol/tc-health-client.json" DefaultLogDirectory = "/var/log/trafficcontrol" DefaultLogFile = "tc-health-client.log" DefaultTOLoginDispersionFactor = 90 DefaultTrafficServerConfigDir = "/opt/trafficserver/etc/trafficserver" DefaultTrafficServerBinDir = "/opt/trafficserver/bin" DefaultMarkupPollThreshold = 1 )
View Source
const ( HealthMethodTrafficMonitor = HealthMethod("traffic-monitor") HealthMethodParentL4 = HealthMethod("parent-l4") HealthMethodParentL7 = HealthMethod("parent-l7") HealthMethodParentService = HealthMethod("parent-service") )
View Source
const DefaultMarkdownMinIntervalMS = 5000
View Source
const DefaultParentHealthL4PollMS = 30000
View Source
const DefaultParentHealthL7PollMS = 30000
View Source
const ParentHealthServicePollMS = 30000
Variables ¶
View Source
var DefaultHealthMethods = []HealthMethod{HealthMethodTrafficMonitor}
View Source
var DefaultMarkdownMethods = []HealthMethod{HealthMethodTrafficMonitor}
Functions ¶
func GetTOLoginDispersion ¶
func LoadConfig ¶
LoadConfig returns whether the config was updated and any error.
Note the cfg may be modified, even if the returned updated is false. Users should create and pass a copy of Cfg if changes on error are not acceptable.
func ReadCredentials ¶
*
- ReadCredentials *
- cfg - the existing config
- updating - when true, existing credentials may be updated from the credential file
Types ¶
type Cfg ¶
type Cfg struct { // TODO fix to not take CDN name, so it can't be wrong. // If this is wrong, the health client runs but just can't find tons of stuff, // resulting in strange not-obvious errors. // Infer from server somehow (config header comment? t3c metadata? hostname -s?) CDNName string `json:"cdn-name"` EnableActiveMarkdowns bool `json:"enable-active-markdowns"` ReasonCode string `json:"reason-code"` TOCredentialFile string `json:"to-credential-file"` TORequestTimeOutSeconds string `json:"to-request-timeout-seconds"` TOPass string `json:"to-pass"` TOUrl string `json:"to-url"` TOUser string `json:"to-user"` TmProxyURL string `json:"tm-proxy-url"` TmPollIntervalSeconds string `json:"tm-poll-interval-seconds"` TOLoginDispersionFactor int `json:"to-login-dispersion-factor"` MarkUpPollThreshold int `json:"markup-poll-threshold"` TrafficServerConfigDir string `json:"trafficserver-config-dir"` TrafficServerBinDir string `json:"trafficserver-bin-dir"` PollStateJSONLog string `json:"poll-state-json-log"` EnablePollStateLog bool `json:"enable-poll-state-log"` HealthClientConfigFile util.ConfigFile CredentialFile util.ConfigFile ParsedProxyURL *url.URL MarkdownMinIntervalMS *uint64 `json:"markdown-min-interval-ms"` ParentHealthL4PollMS uint64 `json:"parent-health-l4-poll-ms"` ParentHealthL7PollMS uint64 `json:"parent-health-l7-poll-ms"` ParentHealthServicePollMS uint64 `json:"parent-health-service-poll-ms"` // ParentHealthServicePort is the port to serve parent health on. To disable serving parent health, set to 0. ParentHealthServicePort int `json:"parent-health-service-port"` // ParentHealthLogLocation may be a file path, stdout, stderr, or null (the empty string is equivalent to null) ParentHealthLogLocation string `json:"parent-health-log-location"` // HealthMethods are the types of health to poll. If omitted, Traffic Monitor health will be used. HealthMethods *[]HealthMethod `json:"health-methods"` // MarkdownMethods are the types of health to consider when marking down parents. // This may be empty or omitted, to never marking down parents. MarkdownMethods *[]HealthMethod `json:"markdown-methods"` // NumHealthWorkers is the number of worker microthreads (goroutines) per health poll method. // Note this only applies to Parent L4, Parent L7, and Parent Service health; the Traffic // Monitor health poll is a single HTTP request and thus doesn't need workers. NumHealthWorkers int `json:"num-health-workers"` // Monitor peers inside strategies.yaml file MonitorStrategiesPeers bool `json:"monitor-strategies-peers"` TMPollingInterval time.Duration TORequestTimeout time.Duration UserAgent string // HostName is this host's short hostname. // If empty, the system's hostname will be used. HostName string }
type HealthMethod ¶
type HealthMethod string
Click to show internal directories.
Click to hide internal directories.