Documentation
¶
Overview ¶
Package httpcheck implements the HTTP(S) monitor type (FA-CHK-10..15).
Index ¶
- Constants
- type Auth
- type Checker
- func (c *Checker) Check(ctx context.Context, env *checker.Env, raw json.RawMessage) checker.Result
- func (*Checker) ConfigSchema() json.RawMessage
- func (*Checker) Name() string
- func (*Checker) Targets(raw json.RawMessage) ([]checker.Target, error)
- func (*Checker) Type() string
- func (*Checker) Validate(cfg json.RawMessage) error
- type Config
- type JSONPathCheck
- type Keyword
Constants ¶
const Type = "http"
Type is the monitor type key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
Type string `json:"type"` // basic | bearer
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Token string `json:"token,omitempty"`
}
Auth adds Basic or Bearer authentication.
type Checker ¶
type Checker struct {
// RootCAs overrides the system trust store (tests only).
RootCAs *x509.CertPool
// contains filtered or unexported fields
}
Checker runs HTTP(S) checks.
func (*Checker) Check ¶
Check implements checker.Checker. Every check uses its own transport without keep-alive, so a failing connection setup is never hidden by a reused connection (FA-CHK-11, PF-13).
func (*Checker) ConfigSchema ¶
func (*Checker) ConfigSchema() json.RawMessage
ConfigSchema implements checker.Checker.
type Config ¶
type Config struct {
URL string `json:"url"`
Method string `json:"method,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
Auth *Auth `json:"auth,omitempty"`
ExpectedStatus string `json:"expectedStatus,omitempty"`
Keyword *Keyword `json:"keyword,omitempty"`
JSONPath *JSONPathCheck `json:"jsonPath,omitempty"`
MaxResponseMs int `json:"maxResponseMs,omitempty"`
FollowRedirects *bool `json:"followRedirects,omitempty"`
MaxRedirects int `json:"maxRedirects,omitempty"`
IgnoreTLSErrors bool `json:"ignoreTlsErrors,omitempty"`
TLSExpiryWarningDays *int `json:"tlsExpiryWarningDays,omitempty"`
IPFamily string `json:"ipFamily,omitempty"`
MaxBodyBytes int `json:"maxBodyBytes,omitempty"`
ConnectTimeoutMs int `json:"connectTimeoutMs,omitempty"`
TLSTimeoutMs int `json:"tlsTimeoutMs,omitempty"`
ResponseHeaderTimeoutMs int `json:"responseHeaderTimeoutMs,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
}
Config is the HTTP(S) monitor configuration. Its JSON form is described by schemaJSON; both must change together.
type JSONPathCheck ¶
JSONPathCheck compares the value at a path with an expected string.