Quotawatch
The quotawatch script was written to enable a server administrator to be made aware of disk quota overusage on an Ensim or Parallels Pro server (referred to as Ensim on this page). For some reason, this functionality was not included in Ensim until recent versions. There was no easy way of monitoring quotas and you needed to check the disk space by logging into each site administration screen for every virtual site to see the disk usage. You can now view site quotas from one place within the admin interface, but you are not notified when a site approaches its disk quota — site administrators are notified of the issue, but not in a way that makes much sense to them! A common problem with running out of disk space, is that sites may find their online store ceases to work — full disk quotas stop the Miva Merchant software being able to write to its data files. Full disk quotas also mean that database-driven sites cannot write new information to their databases, thus breaking the functionality of a lot of dynamic web sites. Emails sent to the site will bounce too.
Using the same Ensim scripts that are used to display usage info in the various control panel screens, quotawatch recursively checks the disk quota of each site and each site's users on the server and displays any quotas that are over a specified trigger warning percentage.
As well as displaying results on screen (in an SSH session), quotawatch also has comprehensive notification options:
- Results for all sites/users on the entire server can be emailed to one or more server administrators
- Resellers can be notified by email of any sites or users that trigger alerts who are associated with them
- Users and site administrators can be notified by email when they trigger an alert. The emails that are sent to these end users are fully customisable and can be modified with details of how they can reduce their disk quota. You could even use these emails as an upsale tool, by advertising your prices for adding extra disk space to their accounts and providing links for them to order from!
Installation
To install quotawatch on an Ensim server, just
grab a tarball
and unzip and untar it (tar -zxvf quotawatch-x.x.x.tar.gz) into a directory on your server. Then have a quick look at
the README text file for some details on installation and run the installquotawatch bash
script.
The installation script will ask you whether you wish to set up hourly watches. If you say 'yes' to this, you will be asked some
additional questions regarding the features of quotawatch that you wish to enable. After all questions have been answered, the
installation script will drop a copy of the quotawatch PHP script into /usr/local/sbin/. If you set up hourly
watches, a bash script will also be placed in /etc/cron.hourly, called quotawatch.cron
After installation, you might also wish to disable the standard Ensim quota checking system which sends out the less helpful
messages to site administrators, to save you doubling up on potential warnings being sent to your customers. To do this, just run
the following command:
chmod -x /etc/cron.hourly/check_quotas
Usage
Once you have installed quotawatch you can simply check for sites/users which are using 90% or more of their disk quota by
typing quotawatch as root. After a short wait, any sites or users that are at or over the default 90% trigger value
will be displayed on screen. You can also use the script with different trigger warning values by using the
-t
or
--trigger
switches. For example, to view all the sites and users who are currently using 25% or more of their disk quota, just run one of the
following commands:
quotawatch -t 25
quotawatch --trigger 25
If you wish to have the results emailed to one or more addresses (useful if you will be running the script as a cron job), you can
just add a comma-separated list of addresses to the quotawatch command. Another example:
email you@youraddress.com and a.n.other@anotherdomain.net when a site is 80% over quota:
quotawatch -t 80 you@youraddress.com,a.n.other@anotherdomain.net
A typical cron script could be created in /etc/cron.hourly with the following format (the installation script will create one for
you):
/usr/local/sbin/quotawatch --reseller --notify --log alerts@hosting-company.com
The above would do the following on an hourly basis:
- run quotawatch with the default 90% trigger
- notify resellers of any offending sites or users associated with them
- notify any offending users or site administrators
- log any alerts and do not notify again until the next day
- email all quota warnings to alerts@hosting-company.com
If ever you are wanting a quick refresher of the quotawatch usage and switches, just issue a
quotawatch --help
(or use
-h
if you prefer) to see usage instructions. For detailed instructions on quotawatch and its associated files, you can view the man
pages:
-
man 8 quotawatch(the same page asman quotawatch) for detailed usage instructions ( read here ) -
man 5 quotawatchfor information about quotawatch's files and their configuration options ( read here ).
Download/View the Source Code
Go to the download section if you want to get a copy for your Ensim server.
Uninstalling Quotawatch
To remove quotawatch and all related config files from your system, just carry out the commands below as root:
rm -rf /usr/local/quotawatch /etc/quotawatch /etc/cron.hourly/quotawatch.cron
rm -f /usr/share/man/man5/quotawatch.5.gz /usr/share/man/man8/quotawatch.8.gz
chmod +x /etc/cron.hourly/check_quotas
(re-enable the Ensim quota monitoring)
quotawatch was developed for Ensim Pro 3.7. It also works on Ensim WEBppliance 3.5 and all successive Ensim versions up to 10.x. At the time of writing, it still works with Parallels Pro version 10.3.3. I have no idea if it works on earlier versions of Ensim, because I have never used anything older than 3.5.
quotawatch is licensed under the GPL; you can redistribute it and/or modify it under the terms of the GNU General Public License. For more information, see http://www.gnu.org/licenses/gpl.html