#!/bin/ash
#
# This script measures the CPU load of SP.
# Log the percentages in the syslog.
#
retval=$(cat /proc/loadavg | awk '{ if ( ( $1 > 2.2) && ($2 > 2.1) && ($3 > 2.0)) printf "1"; else printf "0";}')
if [ $retval -ne 0 ]; then
    cmd_output=$(cat /proc/loadavg | awk '{printf  $1 " " $2 " " $3}')
    txt="SP load is high: $cmd_output"
    /usr/local/bin/sel_logger SP.notice "$txt"
fi
exit $retval
