Documentation
¶
Overview ¶
Package icmpcheck implements the ICMP (ping) monitor type (FA-CHK-30/31).
Index ¶
- Constants
- func DetectMode(ctx context.Context, configured string) (string, error)
- type Checker
- func (*Checker) Check(ctx context.Context, env *checker.Env, raw json.RawMessage) checker.Result
- func (*Checker) ConfigSchema() json.RawMessage
- func (*Checker) Name() string
- func (*Checker) RequiredCapability() string
- func (*Checker) Targets(raw json.RawMessage) ([]checker.Target, error)
- func (*Checker) Type() string
- func (*Checker) Validate(raw json.RawMessage) error
- type Config
Constants ¶
const ( ModeAuto = "auto" ModePrivileged = "privileged" // raw socket, needs CAP_NET_RAW ModeUnprivileged = "unprivileged" // UDP ICMP socket, needs net.ipv4.ping_group_range ModeOff = "off" )
ICMP socket modes.
const Capability = "icmp"
Capability is the node capability ICMP monitors require (FA-CHK-31).
const Type = "icmp"
Type is the monitor type key.
Variables ¶
This section is empty.
Functions ¶
func DetectMode ¶
DetectMode returns the ICMP mode this node can use by pinging the loopback address (FA-CHK-31, FA-NODE-06). configured is auto, privileged, unprivileged or off. For auto, unprivileged is tried first because it needs no capability.
Types ¶
type Checker ¶
type Checker struct{}
Checker runs ICMP checks.
func (*Checker) Check ¶
Check implements checker.Checker. pro-bing opens its own sockets, so the target is resolved here and checked against the dialer's address policy before any packet is sent (FA-SEC-SSRF).
func (*Checker) ConfigSchema ¶
func (*Checker) ConfigSchema() json.RawMessage
ConfigSchema implements checker.Checker.
func (*Checker) RequiredCapability ¶
RequiredCapability implements checker.CapabilityRequirer.
type Config ¶
type Config struct {
Host string `json:"host"`
Count int `json:"count,omitempty"`
IntervalMs int `json:"intervalMs,omitempty"`
// MaxPacketLossPercent: DOWN if the loss exceeds it. The default 100 means
// DOWN only when no reply arrives.
MaxPacketLossPercent *int `json:"maxPacketLossPercent,omitempty"`
IPFamily string `json:"ipFamily,omitempty"`
}
Config is the ICMP monitor configuration.