Last active
December 20, 2015 21:38
-
-
Save tancnle/6198539 to your computer and use it in GitHub Desktop.
Detect used space over 90% threshold
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 | |
OK=0 | |
WARNING=1 | |
ERROR=2 | |
UNKNOWN=3 | |
used_space_limit=90 | |
used_space=`df -k /dev/xvde1 | awk '{print $5}' | tail -1 | sed 's/%//g'` | |
if [[ $used_space -ge $used_space_limit ]] ; then | |
echo "ERROR - current used space $used_space% >= threshold of $used_space_limit%" | |
exit $ERROR | |
fi | |
exit $OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment