network_exporter icon indicating copy to clipboard operation
network_exporter copied to clipboard

Fix ICMP count and cleanup.

Open RomainMou opened this issue 2 years ago • 0 comments

Hello,

While conducting tests with the exporter, I observed something unusual in my packet capture: it appears that the ICMP check doesn't respect the count and always sends three packets:

14:28:45.361446 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 1, seq 0, length 13

14:28:50.360774 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 2, seq 0, length 13
14:28:50.362169 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 1, seq 1, length 13

14:28:55.360262 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 3, seq 0, length 13
14:28:55.361605 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 2, seq 1, length 13
14:28:55.362916 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 1, seq 2, length 13

[...]

14:30:25.380410 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 2, seq 19, length 13
14:30:25.380417 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 3, seq 18, length 13
14:30:25.380525 IP 10.100.3.100 > 10.100.3.1: ICMP echo request, id 4, seq 0, length 13

In reality, it sends one ICMP packet per interval and initiates a new task at each interval until we reach const MaxConcurrentJobs = 3, as evident from the seq being incremented properly to 19 (count was set to 20).

This pull request addresses that issue, I believe. I also noticed that ICMP and TCP checks differed from the others, and attempted to standardize them/remove what seems to not really be used for interval management. However, this is my first time working with Go, so I'm not entirely sure. I may have missed something or made a mistake.

Thank you.

RomainMou avatar Jan 01 '24 15:01 RomainMou