generate & email total bandwidth usage per VM at end of the month


Is it possible that CloudMin could generate and email total bandwidth usage for the whole month, on a per VPS basis?

CloudMin currently sends out an email once a VPS goes over it's limit, so even if this code could be extended a bit to send a final email on the first day of the next month, giving a total bandwidth usage for the previous month.

I want to suggest that maybe one could select that all VM's bandwidth usage gets emailed, or only over-usage VM's, or none (for those who don't want this feature) and perhaps on a per-VM basis as well. For example, Bob's VM doesn't go over-usage but he still wants a usage email at the end of the month



This sounds like something you could script yourself using the Cloudmin API .. for example, you can get the bandwidth usage over the current period with a command like :

cloudmin list-systems --host --multiline | grep "Bandwidth usage towards limit"

It should be possible to write a small shell script to generate this kind of email report.

Also, the command cloudmin list-bandwidth can display usage on a day-by-day basis..

Hi Jamie,

I thought of doing that but thought many others will also find this useful. And I think it would be more "elegant" if it's part of CloudMin than being "hacked into it".

Maybe .. but I want to avoid feature overload. We have an API so that these kinds of features can be relatively easily implemented by users.

I would consider adding this if a few more people ask about it though :-)

+1 for avoiding feature overload, cloudmin already tries to do too much, imho ... People need to get more familiar with the cloudmin api and exploit it better.

Lucian in this very instance the API is a bit limited and we're forced to develop additional scripts to take care of this core feature (IMO). I don't want to have virtualmin bloated, but keeping track of bandwidth usage is (hopefully?) a very important part for any hosting company

Softdux, agreed. The good solution here would be the API getting a bit better reporting this kind of stuff. Ideally the API should be so good that a good web dev could create a functional, fancy web 3.0 interface by only using it.

To make collection of bandwidth usage in the past simpler, I will update the list-systems API command to allow use of the period-ago flag to show bandwidth usage for the previous accounting period (month, week or whatever). This will be in the next Cloudmin release.

Also, the list-bandwidth API command can output an hour-by-hour breakdown of usage by host, which you could then sum up any way you like ..