百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

ping_exporter

> 云原生
开源

使用 https://GitHub.com/digineo/go-ping 的 Prometheus 导出器,用于 ICMP 回声请求

632 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

使用 https://GitHub.com/digineo/go-ping 的 Prometheus 导出器,用于 ICMP 回声请求

ping_exporter

Prometheus exporter for ICMP echo requests using https://github.com/digineo/go-ping

This is a simple server that scrapes go-ping stats and exports them via HTTP for Prometheus consumption. The go-ping library is build and maintained by Digineo GmbH. For more information check the source code.

Getting Started

Config file

Beaking Change: In v1.2.0 the config file format has changed. If you are using a older config file with custom labels, you will need to update it to the new format (see the example below).

Targets can be specified in a YAML based config file:

yaml
targets:
  - 8.8.8.8
  - 8.8.4.4
  - 2001:4860:4860::8888
  - 2001:4860:4860::8844
  - host: google.com
    asn: 15169

dns:
  refresh: 2m15s
  nameserver: 1.1.1.1

ping:
  interval: 2s
  timeout: 3s
  history-size: 42
  payload-size: 120
  fw-mark: 222

options:
  disableIPv6: false

Note: domains are resolved (regularly) to their corresponding A and AAAA records (IPv4 and IPv6). By default, ping_exporter uses the system resolver to translate domain names to IP addresses. You can override the resolver address by specifying the --dns.nameserver flag when starting the binary, e.g.

bash
$ # use Cloudflare's public DNS server
$ ./ping_exporter --dns.nameserver=1.1.1.1:53 [other options]

The configuration file is watched via inotify. If the configuration is changed, ping_exporter will update the targets. To change any global options like the ping interval or history size, you must restart the exporter.

Exported metrics

  • ping_rtt_best_seconds: Best round trip time in seconds
  • ping_rtt_worst_seconds: Worst round trip time in seconds
  • ping_rtt_mean_seconds: Mean round trip time in seconds
  • ping_rtt_std_deviation_seconds: Standard deviation in seconds
  • ping_loss_ratio: Packet loss as a value from 0.0 to 1.0

Each metric has labels ip (the target's IP address), ip_version (4 or 6, corresponding to the IP version), and target (the target's name).

Additionally, a ping_up metric reports whether the exporter is running (and in which version).

Shell

To run the exporter:

bash
$ ./ping_exporter [options] target1 target2 ...

or

bash
$ ./ping_exporter --config.path my-config-file [options]

Help on flags:

bash
$ ./ping_exporter --help

Getting the results for testing via cURL:

bash
$ curl http://localhost:9427/metrics

Running as non-root user

On Linux systems CAP_NET_RAW is required to run ping_exporter as unpriviliged user.

bash
# setcap cap_net_raw+ep /path/to/ping_exporter

When run through a rootless Docker implementation on Linux, the flag --cap-add=CAP_NET_RAW should be added to the docker run invocation.

If being invoked via systemd, you can alternately just add the following settings to the service's unit file in the [Service] section:

bash
CapabilityBoundingSet=CAP_NET_RAW
AmbientCapabilities=CAP_NET_RAW

Docker

https://hub.docker.com/r/czerwonk/ping_exporter

To run the ping_exporter as a Docker container, run:

bash
$ docker run -p 9427:9427 -v /path/to/config/directory:/config:ro --name ping_exporter czerwonk/ping_exporter

Kubernetes

To run the ping_exporter in Kubernetes, you can use the supplied helm chart

Prerequisites

  • Helm v3.0.0+

Installing the chart

To install the chart with the release name ping-exporter:

bash
$ helm repo add ping-exporter "https://czerwonk.github.io/ping_exporter"
"ping-exporter" has been added to your repositories

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ping-exporter" chart repository
Update Complete. ⎈Happy Helming!⎈

$ helm install ping-exporter ping-exporter/ping_exporter
NAME: ping-exporter
...

General parameters

Key Type Default Description
affinity object {} [Affinity]
args list [] Add additional [command-line arguments] when running ping_exporter
config object see [values.yaml] Contains the contents of ping_exporter's [config file]
fullnameOverride string "" String to fully override "ping-exporter.fullname"
image.repository string "czerwonk/ping_exporter" String to override the docker image repository
image.pullPolicy string "IfNotPresent" String to override the pullPolicy
image.tag string "" Overrides the ping_exporter image tag whose default is the chart appVersion
imagePullSecrets list [] If defined, uses a secret to pull an image from a private Docker registry or repository
ingress.enabled bool false Enable an ingress resource for the ping_exporter
ingress.className string "" Defines which ingress controller will implement the resource
ingress.annotations object {} Annotations to be added to the ingress resource
ingress.hosts list [{"host": "chart-example.local", "paths":[{"path": "/", "pathType": "ImplementationSpecific"}]}] Defines the [ingress] hosts and path to proxy
ingress.tls list [] Defines the secret(s) containing TLS certs for the [ingress] host
nameOverride string "" Provide a name in place of ping-exporter
podAnnotations object {} Annotations to be added to ping_exporter pods
podSecurityContext object {} Sets the container-level security context
replicaCount number 1 Override the number of replicas running
resources object {} Defines the ping_exporter pod's resource cpu/memory limits and requests
nodeSelector object {} [Node selector]
securityContext.capabilities object {"add": ["CAP_NET_RAW"]} This object overrided the pod's security context capabilities
service.type string "ClusterIP" Sets the type of kubernetes service which is created for ping_exporter
service.port number 9427 Sets the port in which the kubernetes service will listen on and communicate with the ping_exporter pod
service.annotations object {} Annotations applied to the kubernetes service
serviceAccount.create bool true Create a service account for the application
serviceAccount.annotations object {} Annotations applied to created service account
serviceAccount.name string "" Overrides the application's service account name which defaults to "ping-exporter.fullname"
tolerations list [] [Tolerations]
testConnection.enabled bool true Enable the test connection pod for the ping_exporter

Changes from previous versions

ping_loss_ratio vs ping_loss_percent

Previous versions of the exporter reported packet loss via a metric named ping_loss_percent. This was somewhat misleading / wrong, because it never actually reported a percent value (it was always a value between 0 and 1). To make this more clear, and to match with Prometheus best practices, this metric has been renamed to ping_loss_ratio instead.

If you had already been using an earlier version and want to continue to record this metric in Promet

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goicmploss-detectionpingprometheus

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类云原生
定价开源

> 相关工具

K
Kubernetes
容器编排事实标准
H
Helm
Kubernetes 包管理器
S
seaweedfs
SeaweedFS is a distributed storage system for object storage (S3), file systems, and Iceberg tables,