Virtualmin API list-bandwidth reporting different figures to Virtualmin

Hi,

We're currently trying to integrate the bandwidth figures of subdomains into a database software so that users can see when they exceed the bandwidth and disk space limits we have set them. Our theory was to use the API "list-bandwidth" command and process it, which we are. This said, we can't get the figures to match up and there's a couple of funny things that happen for us. When we run the command:

virtualmin list-bandwidth --domain testdomain.com.au --start 2010-10-01 --end 2010-10-13

We get this:

Array
(
    [0] => testdomain.com.au:
    [1] =>     2010-09-30: mail:235445296 web:275950759
    [2] =>     2010-10-01: mail:559283036 web:66948324
    [3] =>     2010-10-02: mail:0 web:464327
    [4] =>     2010-10-03: mail:123058797 web:31902709
    [5] =>     2010-10-04: mail:508037661 web:441620156
    [6] =>     2010-10-05: mail:352886192 web:159014276
    [7] =>     2010-10-06: mail:322298700 web:201542811
    [8] =>     2010-10-07: mail:267924202 web:171579642
    [9] =>     2010-10-08: mail:447664322 web:116474971
    [10] =>     2010-10-09: mail:0 web:13565701
    [11] =>     2010-10-10: mail:53762790 web:36954023
    [12] =>     2010-10-11: mail:742611822 web:494201474
    [13] =>     2010-10-12: mail:579273944 web:258738882
)

The date range seems to move back a day plus when we compare these figures to the Bandwidth Usage report on Virtualmin, we get the following figures:

Array
(
    [0] => testdomain.com.au:
    [1] =>     2010-09-30: total: 487.71 MB
    [2] =>     2010-10-01: total: 597.22 MB
    [3] =>     2010-10-02: total: 453.44 kB:
    [4] =>     2010-10-03: total: 147.78 MB
    [5] =>     2010-10-04: total: 905.66 MB
    [6] =>     2010-10-05: total: 488.19 MB
    [7] =>     2010-10-06: total: 499.57 MB
    [8] =>     2010-10-07: total: 419.14 MB
    [9] =>     2010-10-08: total: 538.01 MB
    [10] =>     2010-10-09: total: 12.94 MB
    [11] =>     2010-10-10: total: 86.51 MB
    [12] =>     2010-10-11: total: 1.15 GB
    [13] =>     2010-10-12: total: 799.19 MB
    [14] =>     2010-10-13: total: 1.11 GB
)

The only thing we can think is that we are in timezone GMT+10, could this be causing an issue? We're stumped! Any advice would be greatly appreciated.

xkeywee

Server: Operating system: Debian Linux 5.0 Webmin version: 1.520 Virtualmin version: 3.80 Pro Theme version: 7.8 Kernel and CPU: Linux 2.6.26-2-686 on i686

Status: 
Closed (fixed)

Comments

The issue looks to be that Virtualmin's bandwidth usage stats are counted by GMT day, but the time range selection is in local time. The simplest solution is to increase the range in the API call by 1 day in each direction, to make sure you get the days you want..

Does that explain it?

Fantastic. Thanks for the info!

I will switch the dates accepted by that API command to GMT in the next release, to be less confusing.

Automatically closed -- issue fixed for 2 weeks with no activity.