icmpcheckreceiver

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 15 Imported by: 0

README

OpenTelemetry Collector - ICMP Check Receiver

This receiver executes ICMP echo/ping requests to a list of targets and reports the results as metrics.

Features:

  • List of created metrics:
    • ping_rtt: Round-trip time in milliseconds.
    • ping_rtt_min: Minimum round-trip time in milliseconds.
    • ping_rtt_max: Maximum round-trip time in milliseconds.
    • ping_rtt_avg: Average round-trip time in milliseconds.
    • ping_rtt_stddev: Standard deviation of round-trip time in milliseconds.
    • ping_loss_ratio: Packet loss ratio between 0 and 1.
  • Name resolution errors will be logged as warnings and the target will be retried in the next scrape run.

Example Grafana visualization: Grafana

Configuration

The receiver supports the following settings:

  • collection_interval: The interval (duration, e.g. 1m) at which the scraper will run. See scrapehelper for all options.

  • targets: A list of targets to ping.

    target:

    • target: The target to ping. This can be an IP address or hostname.
    • ping_count: The number of pings to send to the target.
    • ping_timeout: The timeout (duration, e.g. 5s) for this target. If ping_count pings are not received within this time, the execution will be stopped.

Example configuration:

receivers:
  icmpcheck:
    collection_interval: 10s
    targets:
      - target: www.amazon.de
        ping_count: 4
        ping_timeout: 5s
      - target: www.amazon.com
      - target: www.doesnot123exiiiiist.coom
      - target: api.amazon.com
      - target: api.amazon.de # request timeout
        ping_timeout: 2s
      - target: 8.8.8.8

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers: [icmpcheck]
      exporters: [debug]

Usage

The receiver can be used in a custom collector build.

Example builder manifest file:

dist:
  name: otelcol-dev
  description: Basic OTel Collector distribution for Developers
  output_path: ./otelcol-dev
  otelcol_version: 0.111.0

exporters:
  - gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.111.0

processors:
  - gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.111.0

receivers:
  - gomod: github.com/thmshmm/icmpcheckreceiver v0.1.0

Documentation

Index

Constants

View Source
const (
	ATTR_PEER_IP         = "net.peer.ip"
	ATTR_PEER_NAME       = "net.peer.name"
	DEFAULT_PING_COUNT   = 3
	DEFAULT_PING_TIMEOUT = 5 * time.Second
)

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() receiver.Factory

Types

type Config

type Config struct {
	scraperhelper.ControllerConfig `mapstructure:",squash"`
	Targets                        []Target `mapstructure:"targets"`
}

type Target

type Target struct {
	Target      string         `mapstructure:"target"`
	PingCount   *int           `mapstructure:"ping_count"`
	PingTimeout *time.Duration `mapstructure:"ping_timeout"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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