prober

package
v0.0.0-...-594395b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Probers = map[string]ProbeFn{
		"http":      ProbeHTTP,
		"tcp":       ProbeTCP,
		"icmp":      ProbeICMP,
		"dns":       ProbeDNS,
		"grpc":      ProbeGRPC,
		"unix":      ProbeUnix,
		"websocket": ProbeWebsocket,
	}
)

Functions

func DebugOutput

func DebugOutput(module *config.Module, logBuffer *bytes.Buffer, registry *prometheus.Registry) string

DebugOutput returns plaintext debug output for a probe.

func Handler

func Handler(w http.ResponseWriter, r *http.Request, c *config.Config, logger *slog.Logger, rh *ResultHistory, timeoutOffset float64, params url.Values,
	moduleUnknownCounter prometheus.Counter,
	promslogConfig *promslog.Config)

func ProbeDNS

func ProbeDNS(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) bool

func ProbeGRPC

func ProbeGRPC(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (success bool)

func ProbeHTTP

func ProbeHTTP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (success bool)

func ProbeICMP

func ProbeICMP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (success bool)

func ProbeTCP

func ProbeTCP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) bool

func ProbeUnix

func ProbeUnix(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) bool

func ProbeWebsocket

func ProbeWebsocket(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (success bool)

Types

type GRPCHealthCheck

type GRPCHealthCheck interface {
	Check(c context.Context, service string, md metadata.MD) (bool, codes.Code, *peer.Peer, string, error)
}

func NewGrpcHealthCheckClient

func NewGrpcHealthCheckClient(conn *grpc.ClientConn) GRPCHealthCheck

type ProbeFn

type ProbeFn func(ctx context.Context, target string, config config.Module, registry *prometheus.Registry, logger *slog.Logger) bool

type Result

type Result struct {
	Id          int64
	ModuleName  string
	Target      string
	DebugOutput string
	Success     bool
}

Result contains the result of the execution of a probe

type ResultHistory

type ResultHistory struct {
	MaxResults uint
	// contains filtered or unexported fields
}

ResultHistory contains two history slices: `results` contains most recent `maxResults` results. After they expire out of `results`, failures will be saved in `preservedFailedResults`. This ensures that we are always able to see debug information about recent failures.

func (*ResultHistory) Add

func (rh *ResultHistory) Add(moduleName, target, debugOutput string, success bool)

Add a result to the history.

func (*ResultHistory) GetById

func (rh *ResultHistory) GetById(id int64) *Result

GetById returns a given result by id.

func (*ResultHistory) GetByTargetAndModule

func (rh *ResultHistory) GetByTargetAndModule(target string, module string) *Result

GetByTargetAndModule returns a given result by target url, optionally filtered by a module name.

func (*ResultHistory) List

func (rh *ResultHistory) List() []*Result

List returns a list of all results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL