• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk 10 per user disk usage report?

JP Kelly

Regular Pleskian
Is it possible for a client to view usage on his domain(s) per user and per email account?
There only seems to be a grand total.
Before he could view usage on each email account and each web user.
 
also cannot find this

our customer are already upset... any idea how to ?
 
a hack

I created a script and custom button for my 1 customer who complained.
This only works for the one customer/domain, I did not have time to make one that works for all users.
It should be pretty easy to modify for your purposes.

The script: (saved in /usr/local/sbin/hogs and chmod 755 and change <THEDOMAIN.COM> to whatever the domain is you are getting usage for)
Code:
#!/bin/sh
#
#lists disk usage by user

echo 'Web Site Files'
du -chs /var/www/vhosts/<THEDOMAIN.COM>/httpdocs/* | tail -1
echo
echo 'Web Users'
du -chs /var/www/vhosts/<THEDOMAIN.COM>/web_users/* | tail -1
du -sk /var/www/vhosts/<THEDOMAIN.COM>/web_users/* | sort -nr | awk '{ print $2 }' | while read f ; do du -sh "$f" | awk -F/var/www/vhosts/<THEDOMAIN.COM>/web_users/ '{ print $1, "\t", $2 }' ; done
echo
echo 'Mail Users'
du -chs /var/qmail/mailnames/<THEDOMAIN.COM>/* | tail -1
du -sk /var/qmail/mailnames/<THEDOMAIN.COM>/* | sort -nr | awk '{ print $2 }' | while read f ; do du -sh "$f" | awk -F/var/qmail/mailnames/<THEDOMAIN.COM>/ '{ print $1, "\t", $2 }' ; done

You will also need to add this to the bottom of the sudoers file (use visudo)
Code:
psaadm  ALL = NOPASSWD: /usr/local/sbin/hogs

The custom button references a page which is placed in /usr/local/psa/admin/htdocs/usage/index.php
The link for the custom button would be https://mydomain.net:8443/usage/index.php I selected "Open URL in Parallels Panel" so it is integrated nicely.
The custom button is added via the user's control panel under the "Account' tab and in "Additional Services" (took me a while to find that one).

Here is the code for index.php
Code:
<style type="text/css">
pre {
        font-family: tahoma, arial, verdana, sans-serif;
        font-size: 12px;
        line-height: 16px;
}
</style>

<div style="margin-left:100px;">
    <div style="width:375px; float:left;">
        <?
        $hogs = shell_exec('sudo /usr/local/sbin/hogs');
        echo 'Usage for <THEDOMAIN.COM>';
        echo "<pre>$hogs</pre>";
        ?>      
    </div>
</div>
 
Last edited:
hi there, thanks first for your help but i'm still having trouble. the script returns
domain.com
Mail Users
0 tota
also i try modifying iindex.php the line of sudo to sh but same result. permission are 644 for this archive and user root. i believe that something is stopping the shell_exec. the php.ini has no restriction on it .. any idea ? also the sudoers is ok
 
hi there, thanks first for your help but i'm still having trouble. the script returns
domain.com
Mail Users
0 tota
also i try modifying iindex.php the line of sudo to sh but same result. permission are 644 for this archive and user root. i believe that something is stopping the shell_exec. the php.ini has no restriction on it .. any idea ? also the sudoers is ok
Did you change /var/www/vhosts/thedomain.com/httpdocs/ to reflect your domain name? (change thedomain.com to whatever your domain is)
 
hi there
yes we change it . weird. we re using a centos 5
 
Does it work wen you paste the command in terminal?
Code:
du -sk /var/www/vhosts/<THEDOMAIN.COM>/web_users/* | sort -nr | awk '{ print $2 }' | while read f ; do du -sh "$f" | awk -F/var/www/vhosts/<THEDOMAIN.COM>/web_users/ '{ print $1, "\t", $2 }' ; done
 
it gives me the list ok. i think something is happening with the variable coz it displays me
domain.....com

Mail Users
with nothing here
 
it gives me the list ok. i think something is happening with the variable coz it displays me
domain.....com

Mail Users
with nothing here

I did not use any variables. The script was written to work with a single domain only.
 
i refer in the index.php when it seems that the shellexec comand does not file. we re using plesk 10.1.1

<?
$hogs = shell_exec('sudo /usr/local/sbin/hogs'); this line is not working and i have no idea why also try sh /usr/local
echo 'domains.com';
echo "<pre>$hogs</pre>";
 
is not working for me.i-m not saying is wrong

i refer in the index.php when it seems that the shellexec comand does not file. we re using plesk 10.1.1

<?
$hogs = shell_exec('sudo /usr/local/sbin/hogs'); this line is not working and i have no idea why also try sh /usr/local
echo 'domains.com';
echo "<pre>$hogs</pre>";
 
Maybe you need the full path to sudo? e.g. /usr/bin/sudo

Are you able to run a simpler command with shell_exec()? Such as /bin/ls /
 
also try that.. nevermind we will wait for the report feature... thanks a lot for your help anyway !
 
Back
Top