Submitted by tbirnseth on Mon, 07/06/2009 - 02:01
Hi guys,
Is there anyway for me to get a simple tabular report of bandwidth used (outbound only) on a per-domain basis? I.e. I'd like to get a report of outbound traffic for each domain on a single page early in the month for the previous month.
I know I can do it graphically for each individual domain, but was hoping there's some kind of reporting mechanism since I get charged on a bandwidth/server (1TB inclusive) and want to charge my heavier use clients who exceed certain limits.
Just a two column table of domain/outbound traffic would be really helpful.
Does this exist? Is there a plan?
thanks, tony
Status:
Closed (fixed)
Comments
How about this?
virtualmin list-bandwidth --all-domains --start 2009-07-01 --end 2009-07-31 --include-subservers
Submitted by tbirnseth on Mon, 07/06/2009 - 11:37 Comment #2
Wow, that was fast. I can run it through awk to create it as a table so I can print it.
Thanks
Submitted by JamieCameron on Mon, 07/06/2009 - 11:38 Comment #3
Cool .. also, you can see per-domain use in the browser at System Settings -> Bandwidth Monitoring -> Show Usage Graph.
Submitted by tbirnseth on Mon, 07/06/2009 - 11:57 Comment #4
Yeah, got to that... But then I have to click each domain. What i'm interested in is the total for the month for each domain....
tony
Submitted by tbirnseth on Mon, 07/06/2009 - 12:00 Comment #5
Any chance the format can be adjusted slightly? I.e. have it generate a csv file with columns of domain,day,mail-use,web-use,ftp-use,total?
Then it could just be exported to excel (might be a good thing in VM itself).
And also, having an option for -totals-only would be nice since I don't really care about the daily activity. It's a billing document.
tony
Submitted by JamieCameron on Mon, 07/06/2009 - 12:03 Comment #6
I could add an option to list-bandwidth to change the output format..
So are you looking to get a 'matrix' by domain and by month of usage in that month?
Submitted by tbirnseth on Mon, 07/06/2009 - 13:50 Comment #7
Yes, in a way.... Quick qualifying question... Is this total bandwidth in and out or just out?
From a command line of: virtualmin list-bandwidth --all-domains --start 2009-07-01 --end 2009-07-31 --include-subservers --totals-only --sep-char ',' --direction outbound
(Note: --sep-char accepts any string as parameter to use as the field separator (default TAB) , --direction being one of inbound, outbound, all (default 'all').
Basically output a file format that looks like from the above command:
Submitted by tbirnseth on Mon, 07/06/2009 - 13:52 Comment #8
Note: all usage should be in MB.
Submitted by JamieCameron on Mon, 07/06/2009 - 16:29 Comment #9
I'll look into it when I get the chance. However, the current list-bandwidth command can provide all the information you need, so it should be relatively simple to write a perl script to convert to a format showing totals for the last month by type..
I've attached a small example to this bug report. You could run it like :
virtualmin list-bandwidth --all-domains --start 2009-06-01 --end 2009-07-01 | /usr/local/bin/bw-csv.pl
Submitted by tbirnseth on Mon, 07/06/2009 - 16:34 Comment #10
Do you have a copy of bw-csv.pl? It's not on my system.
It's in the attachment to Jamie's example. ;-)
Submitted by tbirnseth on Mon, 07/06/2009 - 21:15 Comment #12
Duh!!! Didn't even see it! Somedays I'm just a Homer!
Works great and solves the problem! Thank you.
Now the big question is, what do the numbers represent? Is it total bandwidth (in/out)?
Does it count loopback traffic (I.e. 2 sites on the same host communicating)?
Is there a way to separate it all out into respective chunks?
I don't really care how much is to email, ftp or web. It's all bandwidth.
But I do care what's inbound and what's outbound since there's no limit on inbound but outbound can carry a pretty steep tax once the threshold is broached.
Submitted by JamieCameron on Mon, 07/06/2009 - 22:23 Comment #13
For web, the bandwidth is outgoing only (web content fetched).
For mail and FTP, it is incoming and outgoing traffic.
Submitted by tbirnseth on Mon, 07/06/2009 - 23:04 Comment #14
Perfect!
You can close this one out!
Submitted by JamieCameron on Mon, 07/06/2009 - 23:14 Comment #15