Tuesday, February 26, 2008

LoadAvg and LoadFactor script


#!/bin/sh

printf "\tLoad Average\tLoad Factor(loadavg/#CPU)\n"
cpuno=$(cat /proc/cpuinfo | grep processor | wc -l)

while [ 2 > 1 ]
do

x=$(cat /proc/loadavg | awk '{print $1}')
#y=$(echo $x / $cpuno | bc)
y=`echo $x $cpuno | awk '{print $1/$2}'`
printf "\t$x\t\t$y\n"
sleep $1

done