Quotawatch
The quotawatch script was written to enable a server administrator to be made aware of disk quota usage on an Ensim server. For some reason, this functionality was not included in Ensim until recent versions. There was no easy way of monitoring quotas (and still isn't a way of viewing a server-wide summary) and you needed to check the disk space by logging into each site administration screen for every virtual site to see the disk usage! 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.
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!
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 if you are unsure) 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
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 (caused by Ensim's sitelookup script),
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. Click here to see the PHP source code for quotawatch
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
quotawatch was developed for Ensim Pro 3.7. It also works on Ensim WEBppliance 3.5 and Ensim Pro 4. 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