icmpcheckreceiver

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

  • max_concurrent_pings: An integer number acting as a limit for concurrent pings.

  • 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
    max_concurrent_pings: 200
    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

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

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

receivers:
  - gomod: github.com/thmshmm/icmpcheckreceiver v0.3.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
)
View Source
const (
	DEFAULT_MAX_CONCURRENT_PINGS = 250
)

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"`
	MaxConcurrentPings             int      `mapstructure:"max_concurrent_pings"`
}

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
⌂ 换网址