Skip to content

Instantly share code, notes, and snippets.

@somic
Created November 23, 2010 17:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save somic/712175 to your computer and use it in GitHub Desktop.
Save somic/712175 to your computer and use it in GitHub Desktop.
AWK script to detect missing replies in Linux ping output, based on icmp_seq
#!/usr/bin/awk -f
#
# analyzes ping output on Linux and looks for missed returns
# based on icmp_seq
#
# ping output is expected on stdin
#
BEGIN { num = 0 }
$5 ~ /icmp_seq=/ {
split($5, res, /=/);
if (res[2] != num + 1) {
print "missed between", num, "and", res[2] }
num = res[2];
}
@Avinashreddymum
Copy link

Avinashreddymum commented Dec 9, 2016

After adding the above content to a file, Do i need to capture the ping output to a file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment