bandwidth
Calculate each domain's monthly bandwidth usage (HTTP and FTP) and store it in GoAdmio
- Command:
/go/bandwidth - Category: Monitoring
- Required option: None
- Output: None (updates the database; logs each run)
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/bandwidth measures how much traffic every hosted domain has used this month and saves the total in GoAdmio. For each domain it:
- adds up the HTTP bytes served in the last 24 hours from the access log
- saves that figure as today's row in the bandwidth database
- adds all of this month's daily HTTP rows
- adds the FTP transfer size recorded for the account
- stores the combined total as the domain's
BandwidthUsed
The command does not set or enforce limits. Limits are set when the account is created (see create, --bandwidth); this command keeps the usage figure up to date.
Quick start
# Update bandwidth usage for all domains
/go/bandwidth
Run it on a schedule (for example once a day from cron) so every day has a row.
Syntax
/go/bandwidth
The command takes no options or arguments. It always processes every domain that has a www directory under /home.
If you run it without root, it re-runs itself with sudo.
Options
None. Any arguments you pass are ignored.
Output
The command prints nothing. Check the results in the databases or the log.
| What | Where |
|---|---|
| Daily HTTP bytes per domain | Bandwidth table in /var/lib/sqlite/bandwidth.db |
| Monthly total per domain (bytes) | BandwidthUsed column of the Site table in /var/lib/sqlite/site.db |
| Record of each run | /var/log/go/bandwidth.log |
Each run adds one line to the log, in this form:
[Nov 20 00:10:01]# bandwidth
Examples
# Run once, for all domains
/go/bandwidth
# Run every day at 00:10 (cron entry)
10 0 * * * /go/bandwidth
# Check the stored monthly usage of one domain (bytes)
sqlite3 /var/lib/sqlite/site.db "select BandwidthUsed from Site where Domain='example.com'"
# See the daily rows saved for a domain
sqlite3 /var/lib/sqlite/bandwidth.db "select Date,Bandwidth from Bandwidth where Domain='example.com' order by TimeStamp"
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
BandwidthUsed is 0 for a domain |
No requests in the access log during the last 24 hours. | Check that the domain receives traffic and that the access log is being written. |
| A domain is skipped | It has no /home/<domain>/www directory. |
Check that the account exists and was created correctly. |
| No new row for today | The command did not run. | Check /var/log/go/bandwidth.log and your cron entry. |
sqlite3 errors |
A database is missing or locked. | Check the files in /var/lib/sqlite/ and run again. |
| FTP usage looks too high | See Known issue. | Fix the month filter in the script. |
Details
How HTTP usage is calculated
The access log used by GoAdmio is read with awk. Lines are split on |, and a line counts for a domain when:
| Field | Meaning | Condition |
|---|---|---|
$2 |
Domain | Equals the domain being processed |
$6 |
Time stamp | Newer than 24 hours ago |
$9 |
Bytes sent | Added to the total |
The result is saved as today's row. The row is created on the first run of the day and replaced on every later run, so running the command more than once a day does not double-count.
The monthly HTTP total is the sum of all daily rows whose time stamp is on or after the first day of the current month.
How FTP usage is calculated
The FTP total is the sum of FileSize in the Ftplog table of /var/lib/sqlite/ftplog.db for the account's username. See ftplog for FTP reports.
Known issue: FTP month filter
The FTP query filters by month name and year, but the script never sets the month name. The filter therefore matches the whole year instead of the current month, and FTP usage can be counted for earlier months too.
What it does, in order
- Re-runs itself with
sudoif not root. - Appends a line to
/var/log/go/bandwidth.log. - Loads
/go/functionand the access log path. - Sets today's date, the current time stamp, the time stamp 24 hours ago, and the time stamp of the start of the month.
- For each directory in
/homethat has awwwfolder:- Looks up the account username in
site.db. - Adds the last 24 hours of HTTP bytes from the access log.
- Inserts today's row in
bandwidth.dbif missing, then updates it. - Adds this month's HTTP rows.
- Adds the FTP transfer size.
- Saves HTTP + FTP as
BandwidthUsedinsite.db.
- Looks up the account username in
All values are stored in bytes.
See also
| Command | Description |
|---|---|
create |
Create a GoAdmio account from the command line |
ftplog |
Report FTP activity for a domain |
usertop |
Check recent visitors per domain |
visits |
Check daily visits and estimate capacity |
cron |
Set up main cron jobs in GoAdmio |