Bandwidth reports

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

Joe's picture
Submitted by Joe on Mon, 07/06/2009 - 02:41 Pro Licensee

How about this?

virtualmin list-bandwidth --all-domains --start 2009-07-01 --end 2009-07-31 --include-subservers

Wow, that was fast. I can run it through awk to create it as a table so I can print it.

Thanks

Cool .. also, you can see per-domain use in the browser at System Settings -> Bandwidth Monitoring -> Show Usage Graph.

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

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

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?

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:

Domain,StartDate,EndDate,EmailUsage,FtpUsage,WebUsage,Total
Domain1,6/1/2009,6/30/2009,2.47,40.8,1346.3,1389.57
Domain2,6/1/2009,6/30/2009,12.47,122.6,63045.9,63180.97

Note: all usage should be in MB.

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

Do you have a copy of bw-csv.pl? It's not on my system.

Joe's picture
Submitted by Joe on Mon, 07/06/2009 - 17:02 Pro Licensee

It's in the attachment to Jamie's example. ;-)

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.

For web, the bandwidth is outgoing only (web content fetched).

For mail and FTP, it is incoming and outgoing traffic.

Perfect!

You can close this one out!