Server Load Checking
Added by astuffedtiger on 2017-05-16 19:44:50
#!/bin/bash
currentload=`uptime|grep -o "[0-9]*\.[0-9]*"|xargs|cut -d\. -f1`;
if [ $currentload -gt "10" ];
    then
    echo ":: Hostname ::" > /tmp/serverload
    echo $HOSTNAME >> /tmp/serverload
    echo "" >> /tmp/serverload
    echo ":: Current Uptime & Load Averge ::" >> /tmp/serverload
    echo $(uptime) >> /tmp/serverload
    echo "" >> /tmp/serverload
    echo ":: Current Process Listing ::" >> /tmp/serverload
    ps auwwxf >> /tmp/serverload
    mail -s "LOAD WARNING - $HOSTNAME" email@address.com < /tmp/serverload ;
    rm -f /tmp/serverload
fi