I'm trying to build a script to trigger an action/alert for a linux appliance when load average reaches a specific threshold.
Script looks like this:
!/bin/bash
load=`echo $(cat /proc/loadavg | awk '{print $2}')`
if [ "$load" -gt 5 ]; then
        echo "foo alert!"
fi
echo "System Load $(cat /proc/loadavg)"
Credit to helloacm.com for getting me started here.
When I run it, I get an error:
./foocheck.sh: line 4: [: 0.03: integer expression expected
Which makes sense -- it's seeing the period/decimal and thinking that I'm comparing a string to an integer.
Most solutions I've found for this involve bc -l which isn't available on this appliance.  I need to find a way to compare these values without using bc.  Any ideas?