Skip to content

Instantly share code, notes, and snippets.

@poy
Created June 6, 2017 15:55
Show Gist options
  • Save poy/2afd264560914bb604daa75e86022eae to your computer and use it in GitHub Desktop.
Save poy/2afd264560914bb604daa75e86022eae to your computer and use it in GitHub Desktop.
Detects and counts dropped UDP packets for 60 seconds (for port 0x0d81)
#!/bin/bash
for i in `seq 0 60`; do
echo "sample $i";
timestamp=$(date +%s)
value=$(cat /proc/net/udp | grep ": 0100007F:0D81" | tr -s [:space:] '|' | sed 's/|/ /g' | awk '{print $13}')
echo "$timestamp $value"
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment