Skip to content

Instantly share code, notes, and snippets.

@faicker
Created September 29, 2017 07:36
Show Gist options
  • Save faicker/18e0de8e5d09f0a8fa1875103aa3c638 to your computer and use it in GitHub Desktop.
Save faicker/18e0de8e5d09f0a8fa1875103aa3c638 to your computer and use it in GitHub Desktop.
linux kernel packet drop stat
#!/usr/bin/env bash
function print() {
for nic in ${@}; do
echo "$nic:"
echo " ifconfig:"
ifconfig $nic | grep drop | sed 's/^\s\+//'
echo " ethtool:"
ethtool -S $nic | grep -E '(err|drop|rx_no_dma_resources)' | grep -v ': 0$' | sed 's/^\s\+//'
echo " tc:"
tc -s qdisc show dev $nic | grep -E -A 1 '\(drop.*'
done
echo "/proc/net/softnet_stat:"
cat /proc/net/softnet_stat | awk '{print $2}' | tr '\n' ' '
echo
if which ovs-dpctl >/dev/null; then
echo "ovs-dpctl show:"
ovs-dpctl show
fi
if grep -q '^nf_conntrack ' /proc/modules; then
echo "conntrack stat:"
awk '{print $11,$12}' /proc/net/stat/nf_conntrack
fi
}
if [[ $# -lt 1 ]]; then
echo "usage: $0 eth0 eth1 ..."
exit 1
fi
print ${@:1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment