Manually updating traffic and disk usage for all clients in Plesk

Manually updating traffic and disk usage in Plesk

This blog post will guide you through the process of manually updating the traffic and disk usage for all the clients in Plesk.

The Plesk statistics is a report in Plesk that calculates disk space, Mail Space, Database usage and traffic usage on a per domain and hosting account. Plesk recalculates all usage statistics once every day as part of a daily maintenance script. Sometimes there might be situations (in case you made some updates) where you would like to see the statistics updated immediately rather than “sometime later”.

So, the solution here is to edit the statistics recalculations script and execute it manually.

The standard way to look at the usage statistics is through the control panel itself. You can follow the steps below to view the website Disk Space usage Statistics reports:
1. Login To Plesk Control Panel.
2. Go to Statistics.

The Disk space usage by services chart displays how much space is utilized by the website content, emails, backups, logs, and databases. It makes sense to pay attention to the services that use the most disk space.

Now, let’s see how to run the statistics recalculations script manually. On CentOS you can locate the statistics script file in this path “/usr/local/psa/admin/sbin/statistics”. When used on its own all statistics are recalculated on the spot. Here is the standard usage of the command

/usr/local/psa/admin/sbin/statistics [ options ]

If no options are specified the command calculates the statistics for all domains. Here are a few options to try:

–calculate-all Calculate statistics for all domains
–calculate-one Calculate statistics for
–calculate-list Calculate statistics for listed domains
–generate-all-webstat Generate web-statistics pages for all domains
–generate-domain-webstat Generate web-statistics pages for
-h, –help display this help and exit

Depending on the number of domains you have this can take a minute or two. If you are running several VMs with Plesk, there are chances that you see an increase in the load average because of I/O consumption, which is caused due to the “statistics_collection” process. Also, there are not only web statistics calculation but disk usage, traffic, etc which is performed by the statistics_collection process. In such cases, you may try to completely disable webstat calculation for a particular domain with the following command:

# /usr/local/psa/bin/domain -u domain.com -webstat none

Or if you would like to disable for all the domains, you can use the following command:

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/domain -u $i -webstat none; 

An alternate method to have control over the I/O consumption is to distribute some of your VMs storage to other disks. You can achieve the same with the below script:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e"update misc set
val='byte' where param='size_count_type'"
# /usr/local/psa/admin/sbin/statistics

Another common problem noted w.r.t the web statistics is that the traffic vaule doesn’t get displayed in the Plesk Admin control panel. In such cases the script below could come to your rescue:

# vi /etc/my.cnf

set-variable = wait_timeout=28800

# /usr/local/psa/admin/sbin/reconfig/usr/local/psa/bin/sw-engine-pleskrun
-e /usr/local/psa/admin/plib/DailyMaintainance/script.php

For any assistance on your Plesk server you can reach our server management experts who can provide the expert advise and help you set up things in a timely manner.