./rsrcmeter
rsrcmeter is a small script written in Ruby that provides disk and HTTP bandwidth usage for FreeBSD-based TextDrive hosting accounts.
rsrcmeter is not under active development. Joyent's new Shared Accelerators make rsrcmeter less useful, but if you have a patch or still want it for Shared Accelerators, let me know (see below). Thanks for your interest.
Installing
Installing rsrcmeter is easy from any ssh session. Just execute the following two commands:
curl -o rsrcmeter http://rsrcmeter.textjoy.com/rsrcmeter-latest.txt chmod u+x rsrcmeter
Then, to use the script, just type ./rsrcmeter and press Enter at your ssh session.
Sample Output
Disk usage: 154.5840 MiB (Quota: 20.0000 GiB | 0.8% used) Bandwidth: Feb 2007: 25.5984 MiB (Month to Date) Jan 2007: 164.7072 MiB Dec 2006: 11.9075 MiB Nov 2006: 0.8963 MiB Oct 2006: 0.5087 MiB Sep 2006: 0.5523 MiB
Other Notes
- This script currently does not work on Shared Accelerators, as the Solaris quota tool is different.
- Original ideas for this script were contributed by Filip via Jason Hoffman (posted on TextSnippets).
- The source is available easily: http://rsrcmeter.textjoy.com/rsrcmeter-latest.txt.
Problems/Comments/Etc.
If you need to get in touch, use . I am currently a full-time university student, so support for ./rsrcmeter is limited, but I will try to get back to you in a timely manner.
Configuration and Other Usage
Unofficial TxD Disk & HTTP Bandwidth Usage Meter
Usage: rsrcmeter [options]
-b, --base BASE Change the base directory, defaults to user's $HOME
--stat-file FILE Change default historical data file from 'histstat'
--temp-file FILE Change default temporary file from 'temp-rsrcmeter-bwcalc'
-m NUM Number of months' bandwidth to show prior to current month (default: 5)
-e, --email ADDRESS E-mail results to ADDRESS *instead* of outputting to the screen
-h, --help Show this message
Running from Webmin:
Choose “Run Processes” » Under “Command to run” type:
export HOME="/users/home/YOURUSERNAME"; $HOME/rsrcmeter
Version History
Version 2.0.4 (23 Mar 2007)
- FIXED: rsrcmeter should no longer fail (with an error on line 108) on runs subsequent to the first if the account has less than one full month of bandwidth statistics. Problem was caused when on the first run an empty history file was created and then was expected to contain data. Thanks to Justin W. for the original report.
Version 2.0.2 (5 Jan 2007)
- FIXED: script failed to execute completely if the account had no additional domains/virtual servers setup (and nothing existed at ~/domains/). rsrcmeter now properly checks for the directory before attempting to work with it.
Version 2.0.0
- Major overhaul introduces stored statistics, to improve performance, and handles built-in e-mailing of results for use in cron jobs.