-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print ping messages taking more than 100 ms #87
Print ping messages taking more than 100 ms #87
Conversation
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks not correct to me.
shoot-client/path-controller.sh
Outdated
ping -W 2 -w 2 -c 1 $ip | sed '/\(^PING.*\|^---.*---$\|.*1 packets received.*\|^round-trip.*\|^$\|.*time=.\?..... ms$\)/d' & | ||
ping_pid[$ip]=$! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no expert for bash scripts, but I have doubts that $!
contains the the PID of the ping process.
On Mac I get the PID of the sed instead:
❯ ping -c 1 127.0.0.1 | sed '/\(^PING.*\|^---.*---$\|.*1 packets received.*\|^round-trip.*\|^$\|.*time=.\?..... ms$\)/d' &
[1] 33210 33211
[1] + 33210 done ping -c 1 127.0.0.1 |
33211 done sed
❯ echo $!
33211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I reworked the solution based on your input. The approach using post-processing of the ping output works fine.
The following lines are retained:
- packet loss
- roundtrip delays >= 100 ms
2024-06-04 14:43:11 | {"log":"1 packets transmitted, 0 packets received, 100% packet loss"}
...
2024-06-04 14:43:04 | {"log":"64 bytes from 192.168.123.195: seq=0 ttl=64 time=158.881 ms"}
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
What this PR does / why we need it:
Print ping messages taking more than 100 ms.
In case a ping message in path controller takes more than two seconds the connections is assumed to be broken. However, ICMP messages may get dropped or drowned in a load of traffic. Therefore, it might be interesting to at least see if some messages took longer than usual.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
sed
is used instead ofgrep
as it is already available in the container.Release note:
/cc @MartinWeindel @rfranzke @axel7born