prober

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 53 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,
	}
)

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 log.Logger,
	rh *ResultHistory, timeoutOffset float64, params url.Values)

func ProbeDNS

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

func ProbeGRPC

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

func ProbeHTTP

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

func ProbeICMP

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

func ProbeTCP

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

Types

type GRPCHealthCheck

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

func NewGrpcHealthCheckClient

func NewGrpcHealthCheckClient(conn *grpc.ClientConn) GRPCHealthCheck

type IpTor

type IpTor struct {
	Ip   string //v4, v6, domain
	Name string
}

type PingSchedule

type PingSchedule struct {
	Conf            *config.SafeConfig
	Logger          log.Logger
	Limit           int
	Interval        time.Duration
	MaxDeley        time.Duration
	Timeout         time.Duration
	IPProtocol      string
	SourceIPAddress string
	StopCh          chan bool
}

func (*PingSchedule) Start

func (ps *PingSchedule) Start()

func (*PingSchedule) Stop

func (ps *PingSchedule) Stop()

type ProbeFn

type ProbeFn func(ctx context.Context, target string, config config.Module, registry *prometheus.Registry, logger log.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) Get

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

Get returns a given result.

func (*ResultHistory) List

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

List returns a list of all results.

type Service

type Service interface {
	Start()
	Stop()
}

func NewPingSchedule

func NewPingSchedule(sc *config.SafeConfig, concurrentLimit uint,
	interval, maxDeley, timeout time.Duration, protocal string, ipaddr string, logger log.Logger) Service

Jump to

Keyboard shortcuts

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