Documentation
¶
Index ¶
- Constants
- func NewCheck() checks.Check
- func TraceRoute(ctx context.Context, cfg tracerouteConfig) (map[int][]Hop, error)
- type Config
- type Hop
- type HopAddress
- type Target
- type Traceroute
- func (tr *Traceroute) GetConfig() checks.Runtime
- func (tr *Traceroute) GetMetricCollectors() []prometheus.Collector
- func (tr *Traceroute) Name() string
- func (tr *Traceroute) RemoveLabelledMetrics(target string) error
- func (tr *Traceroute) Run(ctx context.Context, cResult chan checks.ResultDTO) error
- func (tr *Traceroute) Schema() (*openapi3.SchemaRef, error)
- func (tr *Traceroute) Shutdown()
- func (tr *Traceroute) UpdateConfig(cfg checks.Runtime) error
Constants ¶
const ( // IPv4HeaderSize is the size of an IPv4 header in bytes IPv4HeaderSize = 20 // IPv6HeaderSize is the size of an IPv6 header in bytes IPv6HeaderSize = 40 )
const CheckName = "traceroute"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Targets is a list of targets to traceroute to Targets []Target `json:"targets" yaml:"targets" mapstructure:"targets"` // Retry defines if and how to retry a target Retry helper.RetryConfig `json:"retry" yaml:"retry" mapstructure:"retry"` // MaxHops is the maximum number of hops to try before giving up MaxHops int `json:"maxHops" yaml:"maxHops" mapstructure:"maxHops"` // Interval is the time to wait between check iterations Interval time.Duration `json:"interval" yaml:"interval" mapstructure:"interval"` // Timeout is the maximum time to wait for a response from a hop Timeout time.Duration `json:"timeout" yaml:"timeout" mapstructure:"timeout"` }
Config is the configuration for the traceroute check
type Hop ¶ added in v0.5.0
type Hop struct { Latency time.Duration `json:"latency" yaml:"latency" mapstructure:"latency"` Addr HopAddress `json:"addr" yaml:"addr" mapstructure:"addr"` Name string `json:"name" yaml:"name" mapstructure:"name"` Ttl int `json:"ttl" yaml:"ttl" mapstructure:"ttl"` Reached bool `json:"reached" yaml:"reached" mapstructure:"reached"` }
Hop represents a single hop in a traceroute
type HopAddress ¶ added in v0.5.0
type HopAddress struct { IP string `json:"ip" yaml:"ip" mapstructure:"ip"` Port int `json:"port" yaml:"port" mapstructure:"port"` }
HopAddress represents an IP address and port
func (HopAddress) String ¶ added in v0.5.0
func (a HopAddress) String() string
String returns the string representation of the HopAddress.
type Target ¶
type Traceroute ¶
func (*Traceroute) GetConfig ¶
func (tr *Traceroute) GetConfig() checks.Runtime
GetConfig returns the current configuration of the check
func (*Traceroute) GetMetricCollectors ¶
func (tr *Traceroute) GetMetricCollectors() []prometheus.Collector
GetMetricCollectors allows the check to provide prometheus metric collectors
func (*Traceroute) RemoveLabelledMetrics ¶ added in v0.5.0
func (tr *Traceroute) RemoveLabelledMetrics(target string) error
RemoveLabelledMetrics removes the metrics which have the passed target as a label
func (*Traceroute) Schema ¶
func (tr *Traceroute) Schema() (*openapi3.SchemaRef, error)
Schema returns an openapi3.SchemaRef of the result type returned by the check
func (*Traceroute) Shutdown ¶
func (tr *Traceroute) Shutdown()
Shutdown is called once when the check is unregistered or sparrow shuts down
func (*Traceroute) UpdateConfig ¶ added in v0.5.0
func (tr *Traceroute) UpdateConfig(cfg checks.Runtime) error
UpdateConfig is called once when the check is registered This is also called while the check is running, if the remote config is updated This should return an error if the config is invalid