Usage component generates statistics for various usage types. These statistics can be translated to the end user billing details depending on the customer billing criteria.
...
usage.stats.job.exec.time | Time of the day when Usage Job runs to generate usage statistics. HH:MM format. Jobs runs every x minutes defined by usage.stats.job.aggregation.range thereafter. | 00:15 |
usage.execution.timezone | The timezone to use for usage job execution time | Usage server timezone |
usage.aggregation.timezone | The timezone to use for usage stats aggregation | GMT |
usage.sanity.check.interval | Interval (in days) to check sanity of usage data | Disabled (null) |
|
|
|
Usage Server runs as a separate component. Usage Server schedules a job at the time specified by usage.stats.job.exec.time parameter. This job will query the cloud DB usage_events table and generates usage records.
Broadly usage generation sequence is as follows:
...
cloud.user_statistics is queried and populated to cloud_usage.user_statistics with latest stats. Network helper entry is created in usage_network table. Network usage for current event is calculated as:
bytesSent = (total bytes sent) – (bytes sent prior to this event);
bytesReceived = (total bytes received) – (bytes received prior to this event);
Usage entry is created by querying usage_network table for all entries with event_time in the given range.
type
Network usage is processed differently and is not driven by usage events. In Virtual Networking case Iptables rules are set in domR to track public traffic.
Iptables rules are as follows:
iptables -A NETWORK_STATS -i eth0 -o eth2
iptables -A NETWORK_STATS -i eth2 -o eth0
iptables -A NETWORK_STATS -o eth2 ! -i eth0 -p tcp
iptables -A NETWORK_STATS -i eth2 ! -o eth0 -p tcp
Similar rules will be added if there are multiple public interfaces.
Management server queries for these stats periodically and populates them in user_statistics table account-wise. router.stats.interval parameter defines the frequency to fetch these stats. Stats received are cumulative and are stored in current_bytes_received and current_bytes_sent columns. Iptable counters are reset when the domR restarts. Upon a restart, current_bytes in user_statistics table are moved to net_bytes columns. A diff of total usage (current_bytes + net_bytes) in previous aggregation period and current period will give the network usage.
agg_bytes = current_bytes + net_bytes
...
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
name | virtual machine name |
description | description of the usage record |
templateid | template ID |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | virtual machine ID |
virtualmachineid | virtual machine ID |
offeringid | service offering ID |
type | Hypervisor type |
usagetype | 1 - Running_VM 2- Allocated VM |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | IP Address ID |
issourcenat | True if IP is source NAT |
iselastic | True if IP is elastic |
usagetype | 3 - IP Address |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
...
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
rawusage | raw usage in bytes |
usageid | Device Id (Virtual Router ID, External Device ID) |
type | Device Type (Domain Router, External Load Balancer etc) |
networkid | Id of the network for which the traffic was generated |
usagetype | 4 - Network_Bytes_Sent, 5 - Network_Bytes_Received |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
templateid | template ID |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | volume ID |
size | volume size |
offeringid | disk offering ID |
usagetype | 6 - Volume |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
templateid | source template ID |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | template ID |
size | template size |
usagetype | 7 - Template |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | ISO ID |
size | ISO size |
usagetype | 8 - ISO |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | snapshot ID |
size | snapshot size |
usagetype | 9 - Snapshot |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | Load Balancer Policy ID |
usagetype | 11 - Load Balancer |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
usage | usage in hours |
rawusage | raw usage in hours |
usageid | port forwarding rule ID |
usagetype | 12 - Port Forwarding |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name |
accountid | the user account Id |
domainid | the domain ID to which the account belongs |
zoneid | the zone ID |
description | description of the usage record |
usage | usage in hours |
rawusage | raw usage in hours |
offeringid | network offering ID |
vitrualmachineid | virtual machine ID |
isdefault | True if the default NIC uses this network offering |
usagetype | 13 - Network Offering |
startdate | start date of the usage record |
enddate | end date of the usage record |
|
|
Response NameDescription
account | the user account name | |
accountid | the user account Id | |
domainid | the domain ID to which the account belongs | |
zoneid | the zone ID | |
description | description of the usage record | |
usage | usage in hours | |
rawusage | raw usage in hours | |
usageid | VPN user ID | |
usagetype | 14 - VPN Users | |
startdate | start date of the usage record | |
enddate | end date of the usage record | |
|
|
|