OUT=$(/usr/local/cpanel/bin/dcpumonview | grep -v Top | sed -e ‘s#<[^>]*># #g’ | while read i ; do NF=`echo $i | awk {‘print NF’}` ; if [[ “$NF” == “5” ]] ; then USER=`echo $i | awk {‘print $1’}`; OWNER=`grep -e “^OWNER=” /var/cpanel/users/$USER | cut -d= -f2` ; echo “$OWNER $i”; fi ; done) ; (echo “USER CPU” ; echo “$OUT” | sort -nrk4 | awk ‘{printf “%s %s%\n”,$2,$4}’ | head -5) | column -t ;echo;(echo -e “USER MEMORY” ; echo “$OUT” | sort -nrk5 | awk ‘{printf “%s %s%\n”,$2,$5}’ | head -5) | column -t ;echo;(echo -e “USER MYSQL” ; echo “$OUT” | sort -nrk6 | awk ‘{printf “%s %s%\n”,$2,$6}’ | head -5) | column -t ;

 

USER CPU
user1 2.51%
user2 1.48%
user3 1.04%
user4 0.77%
user5 0.61%

USER MEMORY
user1 5.67%
user2 0.38%
user3 0.38%
user4 0.13%
user5 0.12%

USER MYSQL
user1 0.3%
user2 0.0%
user3 0.0%
user4 0.0%
user5 0.0%

Advertisements