Update check_pf_cpu

Different output from top when upgraded from 2.45 to 2.5 (21.02). This modification works for both new and old.
This commit is contained in:
Dallas 2021-02-19 14:54:54 -06:00 committed by GitHub
parent c2d3e8d21f
commit 7e814fef25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@
if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ] ; then
warn=$2
crit=$4
IDLE=$(top -b -d2 | grep 'CPU:' | cut -d',' -f5 | cut -d'%' -f1 | cut -d'.' -f1 | sed -e 's/^[ \t]*//')||exit 3
IDLE=$(top -b -d2 | grep 'CPU:' | cut -d',' -f5 | cut -d'%' -f1 | cut -d'.' -f1 | sed -e 's/^[ \t]*//' | tail -1)||exit 3
#UTIL=`echo "100-$IDLE"| bc`
UTIL=`expr 100 - $IDLE`
#UTIL_RND=`echo "100-$IDLE"| bc | awk '{printf("%d\n",$1 + 0.5)}'`