Documentation ¶
Overview ¶
Package prober implements a simple blackbox prober. Each probe runs in its own goroutine, and run results are recorded as Prometheus metrics.
Index ¶
- func DERP(p *Prober, derpMapURL string, ...) (*derpProber, error)
- func SendAlert(summary, details string) error
- func SendWarning(details string) error
- type Probe
- type ProbeFunc
- type ProbeInfo
- type Prober
- func (p *Prober) ProbeInfo() map[string]ProbeInfo
- func (p *Prober) Run(name string, interval time.Duration, labels map[string]string, fun ProbeFunc) *Probe
- func (p *Prober) Wait()
- func (p *Prober) WithMetricNamespace(n string) *Prober
- func (p *Prober) WithOnce(s bool) *Prober
- func (p *Prober) WithSpread(s bool) *Prober
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DERP ¶
func DERP(p *Prober, derpMapURL string, udpInterval, meshInterval, tlsInterval time.Duration) (*derpProber, error)
DERP creates a new derpProber.
func SendAlert ¶
SendAlert sends an alert to the incident response system, to page a human responder immediately. summary should be short and state the nature of the emergency. details can be longer, up to 29 KBytes.
func SendWarning ¶
SendWarning will post a message to Slack. details should be a description of the issue.
Types ¶
type Probe ¶
type Probe struct {
// contains filtered or unexported fields
}
Probe is a probe that healthchecks something and updates Prometheus metrics with the results.
func (*Probe) Close ¶
Close shuts down the Probe and unregisters it from its Prober. It is safe to Run a new probe of the same name after Close returns.
func (*Probe) Collect ¶
func (p *Probe) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Probe) Describe ¶
func (p *Probe) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
type ProbeFunc ¶
ProbeFunc is a function that probes something and reports whether the probe succeeded. The provided context's deadline must be obeyed for correct probe scheduling.
func HTTP ¶
HTTP returns a Probe that healthchecks an HTTP URL.
The ProbeFunc sends a GET request for url, expects an HTTP 200 response, and verifies that want is present in the response body.
func TCP ¶
TCP returns a Probe that healthchecks a TCP endpoint.
The ProbeFunc reports whether it can successfully connect to addr.
type Prober ¶
type Prober struct {
// contains filtered or unexported fields
}
a Prober manages a set of probes and keeps track of their results.
func (*Prober) Run ¶
func (p *Prober) Run(name string, interval time.Duration, labels map[string]string, fun ProbeFunc) *Probe
Run executes fun every interval, and exports probe results under probeName.
Registering a probe under an already-registered name panics.
func (*Prober) Wait ¶
func (p *Prober) Wait()
Wait blocks until all probes have finished execution. It should typically be used with the `once` mode to wait for probes to finish before collecting their results.
func (*Prober) WithMetricNamespace ¶
WithMetricNamespace allows changing metric name prefix from the default `prober`.
func (*Prober) WithOnce ¶
WithOnce mode can be used if you want to run all configured probes once rather than on a schedule.
func (*Prober) WithSpread ¶
WithSpread is used to enable random delay before the first run of each added probe.