czerwonk / ping_exporter

Prometheus exporter for ICMP echo requests using https://github.com/digineo/go-ping
MIT License
530 stars 115 forks source link

ping_loss_ratio not work (Version: 1.0.1) #83

Open xrayou opened 1 year ago

xrayou commented 1 year ago

After running for a period of time, the ping_loss_ratio suddenly stopped working, and other metrics were updated in real-time, but the ping_loss_ratio remained at 1 until it was restarted.

======before restart===============

[root@gz-yw-internet-ping-83-10 ping_exporter]# curl http://127.0.0.1:9102/metrics  
# HELP ping_loss_ratio Packet loss from 0.0 to 1.0
# TYPE ping_loss_ratio gauge
ping_loss_ratio{ip="119.29.29.29",ip_version="4",target="119.29.29.29"} 1
ping_loss_ratio{ip="180.76.76.76",ip_version="4",target="180.76.76.76"} 1
ping_loss_ratio{ip="223.5.5.5",ip_version="4",target="223.5.5.5"} 1
# HELP ping_up ping_exporter version
# TYPE ping_up gauge
ping_up{version="1.0.1"} 1
[root@gz-yw-internet-ping-83-10 ping_exporter]# ping 119.29.29.29
PING 119.29.29.29 (119.29.29.29) 56(84) bytes of data.
64 bytes from 119.29.29.29: icmp_seq=1 ttl=46 time=6.87 ms
64 bytes from 119.29.29.29: icmp_seq=2 ttl=46 time=6.96 ms
^C
--- 119.29.29.29 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 6.875/6.921/6.968/0.095 ms
[root@gz-yw-internet-ping-83-10 ping_exporter]# ping 180.76.76.76
PING 180.76.76.76 (180.76.76.76) 56(84) bytes of data.
64 bytes from 180.76.76.76: icmp_seq=1 ttl=49 time=30.6 ms
64 bytes from 180.76.76.76: icmp_seq=2 ttl=49 time=30.6 ms
^C
--- 180.76.76.76 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 30.626/30.633/30.640/0.007 ms
[root@gz-yw-internet-ping-83-10 ping_exporter]# curl http://127.0.0.1:9102/metrics
# HELP ping_loss_ratio Packet loss from 0.0 to 1.0
# TYPE ping_loss_ratio gauge
ping_loss_ratio{ip="119.29.29.29",ip_version="4",target="119.29.29.29"} 1
ping_loss_ratio{ip="180.76.76.76",ip_version="4",target="180.76.76.76"} 1
ping_loss_ratio{ip="223.5.5.5",ip_version="4",target="223.5.5.5"} 1
# HELP ping_up ping_exporter version
# TYPE ping_up gauge
ping_up{version="1.0.1"} 1

======after restart===============

[root@gz-yw-internet-ping-83-10 ~]# systemctl restart ping_exporter
[root@gz-yw-internet-ping-83-10 ~]# curl http://127.0.0.1:9102/metrics
# HELP ping_up ping_exporter version
# TYPE ping_up gauge
ping_up{version="1.0.1"} 1
[root@gz-yw-internet-ping-83-10 ~]# curl http://127.0.0.1:9102/metrics
# HELP ping_loss_ratio Packet loss from 0.0 to 1.0
# TYPE ping_loss_ratio gauge
ping_loss_ratio{ip="119.29.29.29",ip_version="4",target="119.29.29.29"} 0
ping_loss_ratio{ip="180.76.76.76",ip_version="4",target="180.76.76.76"} 0
ping_loss_ratio{ip="223.5.5.5",ip_version="4",target="223.5.5.5"} 0

============== image There are no log displays : image

iAmGroute commented 1 year ago

Same here, it was running well for days, without any ping loss. At some point, some hosts were unreachable for several minutes and their ping_loss_ratio correctly went to 1. However, it stayed 1 even after the hosts became reachable again. Restarted ping_exporter and ping_loss_ratio is now 0 and RTTs show up again (in my case, the RTTs for these hosts were not updated while ping_loss_ratio was 1.