Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bahadoribnm/7557ccaf8679dd9f1de70f679ebd0283 to your computer and use it in GitHub Desktop.
Save bahadoribnm/7557ccaf8679dd9f1de70f679ebd0283 to your computer and use it in GitHub Desktop.
Script to check cPanel CPU and Memory usage for a specific user
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
@bahadoribnm
Copy link
Author

Replace "thedomain.com" with Your Domain Addresss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment