Skip to content

Instantly share code, notes, and snippets.

@angelbotto
Last active September 27, 2015 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelbotto/077702e24cb9f5190b05 to your computer and use it in GitHub Desktop.
Save angelbotto/077702e24cb9f5190b05 to your computer and use it in GitHub Desktop.
checks consul
#!/bin/bash
cpuused=`top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}'`
critical=90
warning=60
if [[ $cpuused > $critical ]]; then
echo "CPU CRITIC $cpuused"
exit 2
elif [[ $cpuused > $warning ]]; then
echo "CPU HIGH $cpuused"
exit 1
else
echo "CPU COOL"
exit 0
fi
#!/bin/bash
freespace=`df | awk 'NR == 2 { print $5+0; exit }'`
critical=90
warning=60
if [ "$freespace" -gt $critical ]; then
echo "DISK USE CRITICAL $freespace"
exit 2;
elif [ "$freespace" -gt $warning ]; then
echo "DISK USE WARNING: $freespace"
exit 1;
else
echo "DISCK USE FINE"
exit 0;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment