Skip to content

Instantly share code, notes, and snippets.

@tancnle
Last active December 20, 2015 21:38
Show Gist options
  • Save tancnle/6198539 to your computer and use it in GitHub Desktop.
Save tancnle/6198539 to your computer and use it in GitHub Desktop.
Detect used space over 90% threshold
#!/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