Created
March 14, 2018 22:14
-
-
Save mehulved/8c3bde2f7c33a980b8cbea8485b67639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ETHTOOL=/sbin/ethtool | |
NETWORK_INTERFACE=eth0 | |
ERROR_STATS=$($ETHTOOL -S $NETWORK_INTERFACE | grep errors | tr -d " ") | |
for STAT in $ERROR_STATS | |
do | |
KEY=$(echo $STAT | awk -F ':' '{print $1}') | |
VALUE=$(echo $STAT | awk -F ':' '{print $2}') | |
if [[ $VALUE != 0 ]] | |
then | |
echo "$KEY has non-zero value of $VALUE." | |
exit 1 | |
else | |
echo "$KEY has value $VALUE." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment