How to check cPanel CPU and Memory usage for a specific user
There are a few ways to do this and I will explain some of them for you below. cPanel has a "built in" way to view this but I will give you a way to specify the amount of days you want the stats for and a few other neat tricks.
cPanel Resource Usage Stats
To view cPanel’s stats you can run this command via SSH:
1 |
/usr/local/cpanel/bin/dcpumonview |
This will show all processes, users, etc.
Get cPanel Resource Stats for X Days
If you want to get the stats for a user for say the past 5 days or so, run this command in SSH:
1 |
domain="thedomain.com"; for i in `seq 1 7 `; do let i=$i+1 ; let k=$i-1 ; let s="$(date +%s) - (k-1)*86400"; let t="$(date +%s) - (k-2)*86400"; echo `date -Idate -d @$s`; /usr/local/cpanel/bin/dcpumonview `date -d @$s +%s` `date -d @$t +%s` | sed -r -e 's@^<tr bgcolor=#[[:xdigit:]]+><td>(.*)</td><td>(.*)</td><td>(.*)</td><td>(.*)</td><td>(.*)</td></tr>$@Account: \1\tDomain: \2\tCPU: \3\tMem: \4\tMySQL: \5@' -e 's@^<tr><td>Top Process</td><td>(.*)</td><td colspan=3>(.*)</td></tr>$@\1 - \2@' | grep $domain -A3 ; done |
Courtesy of https://sites.google.com/site/pleskylinuxcom/bash-scripting
If you want to just monitor a specific user and not access the logs you can do so with these commands:
Monitor specific user using TOP
1 |
top -c d2 -u username |
Monitor all users using TOP
1 |
top -c d2 |
Alternately you can use htop instead of top if you have it installed.
-
Ryan