Documentation
¶
Index ¶
Constants ¶
const DefaultPollFrequency = 30 * time.Second
Variables ¶
var ( DefaultConfig Config = Config{ PollFrequency: model.Duration(DefaultPollFrequency), } DefaultHostConfig HostConfig = HostConfig{ PollFrequency: DefaultConfig.PollFrequency, } DefaultBasicServiceConfig = BasicServiceConfig{ Protocol: "tcp", } DefaultChallengeResponseServiceConfig = ChallengeResponseConfig{ BasicServiceConfig: DefaultBasicServiceConfig, } DefaultHTTPServiceConfig = HTTPServiceConfig{ ChallengeResponseConfig: DefaultChallengeResponseServiceConfig, } )
var (
ErrUnknownFields = errors.New("unknown fields in config map")
)
Functions ¶
Types ¶
type BasicServiceConfig ¶
type BasicServiceConfig struct { Name string `yaml:"name"` // Name of the service Protocol string `yaml:"proto,omitempty"` // TCP or UDP Port uint64 `yaml:"port"` // Port number of the service Timeout model.Duration `yaml:"timeout,omitempty"` // Number of seconds to wait for response UseSSL bool `yaml:"ssl,omitempty"` // The service uses SSL }
A basic network service.
func (*BasicServiceConfig) UnmarshalYAML ¶
func (bsc *BasicServiceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type Bytes ¶
type Bytes []byte
Bytes implements a custom []byte slice so we can unmarshal one from an escaped string.
func (*Bytes) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Bytes) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ChallengeResponseConfig ¶
type ChallengeResponseConfig struct { BasicServiceConfig `yaml:",inline,omitempty"` ChallengeLiteral *Bytes `yaml:"challenge,omitempty"` ResponseRegex *Regexp `yaml:"response_re,omitempty"` // Regex that must match ResponseLiteral *Bytes `yaml:"response,omitempty"` // Literal string that must match MaxBytes uint64 `yaml:"max_bytes,omitempty"` // Maximum number of bytes to read while looking for the response regex. 0 means read until connection closes. }
Similar to a banner check, but first sends the specified data befoe looking for a response.
func (*ChallengeResponseConfig) UnmarshalYAML ¶
func (chrc *ChallengeResponseConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type ChallengeResponseConfigValidationError ¶
type ChallengeResponseConfigValidationError struct {
ServiceDescription string
}
func (ChallengeResponseConfigValidationError) Error ¶
func (r ChallengeResponseConfigValidationError) Error() string
type Config ¶
type Config struct { BasicAuthUsername string `yaml:"username,omitempty"` // If set, enables basic auth BasicAuthPassword string `yaml:"password,omitempty"` // If set, enables basic auth (must have a username) TLSCertificatePath string `yaml:"tls_cert,omitempty"` // Path to TLS certificate. Enables TLS if specified. TLSKeyPath string `yaml:"tls_key,omitempty"` // Path to TLS key file. Enables TLS if specified. PollFrequency model.Duration `yaml:"poll_frequency,omitempty"` // Default polling frequency for hosts PingTimeout model.Duration `yaml:"ping_timeout,omitempty"` // Default ping time out for hosts Timeout model.Duration `yaml:"timeout,omitempty"` // Default service IO timeout MaxBytes uint64 `yaml:"max_bytes,omitempty"` // Default maximum bytes to read from services PingDisable bool `yaml:"disable_ping,omitempty"` // Disable ping checks by default PingCount uint64 `yaml:"ping_count,omitempty"` // Number of pings to send Hosts []HostConfig `yaml:"hosts"` // List of hosts which are to be polled XXX map[string]interface{} `yaml:",omitempty"` // Catch any unknown flags. OriginalConfig string // Original config file contents }
func LoadFromFile ¶
func (*Config) UnmarshalYAML ¶
type HTTPServiceConfig ¶
type HTTPServiceConfig struct { ChallengeResponseConfig `yaml:",inline,omitempty"` Verb string `yaml:"verb,omitempty"` // HTTP verb to use URL URL `yaml:"url,omitempty"` // HTTP request URL to send SuccessStatuses HTTPStatusRange `yaml:"success_status,omitempty"` // List of status codes indicating success BasicAuth bool `yaml:"auth,omitempty"` // Use HTTP basic auth Username string `yaml:"username,omitempty"` // Username for HTTP basic auth Password string `yaml:"password,omitempty"` // Password for HTTP basic auth }
An HTTP speaking service. Does not yet support being a proxy. If UseSSL is not set but you request HTTPS, it'll fail.
func (*HTTPServiceConfig) UnmarshalYAML ¶
func (hsc *HTTPServiceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type HTTPStatusRange ¶
HTTPStatusRange is a range of HTTP status codes which can be specifid in YAML using human-friendly ranging notation.
func (HTTPStatusRange) MarshalYAML ¶
func (hsr HTTPStatusRange) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (*HTTPStatusRange) UnmarshalYAML ¶
func (hsr *HTTPStatusRange) UnmarshalYAML(unmarshal func(interface{}) error) error
type HostConfig ¶
type HostConfig struct { Hostname string `yaml:"hostname"` // Host or IP to contact PollFrequency model.Duration `yaml:"poll_frequency,omitempty"` // Frequency to poll this specific host PingDisable bool `yaml:"disable_ping,omitempty"` // Disable ping checks for this host PingTimeout model.Duration `yaml:"ping_timeout,omitempty"` // Maximum ping timeout PingCount uint64 `yaml:"ping_count,omitempty"` // Number of pings to send each poll BasicChecks []*BasicServiceConfig `yaml:"basic_checks,omitempty"` ChallengeResponseChecks []*ChallengeResponseConfig `yaml:"challenge_response_checks,omitempty"` HTTPChecks []*HTTPServiceConfig `yaml:"http_checks,omitempty"` XXX map[string]interface{} `yaml:",omitempty"` // Catch any unknown flags. }
Defines a host which we want to find service information about. Hosts export DNS checks.
func (*HostConfig) UnmarshalYAML ¶
func (c *HostConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type IPNetwork ¶
IPNetwork is the config wrapper type for an IP Network.
func (IPNetwork) MarshalYAML ¶
func (*IPNetwork) UnmarshalYAML ¶
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.
func MustNewRegexp ¶
MustNewRegexp works like NewRegexp, but panics if the regular expression does not compile.
func NewRegexp ¶
NewRegexp creates a new anchored Regexp and returns an error if the passed-in regular expression does not compile.
func (*Regexp) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Regexp) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type URL ¶
URL is a custom URL type that allows validation at configuration load time.
func (URL) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for URLs.
func (*URL) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.