The Usage Server takes data from the events in the system and
enables usage-based billing for accounts in
cloudstack. The usage records
show the amount of resources, such as VM run time or template storage space,
consumed by guest instances. When multiple Management Servers are
present, the Usage Server may be installed on any number of them. The Usage
Servers will coordinate usage processing. A site that is concerned about
availability should install Usage Servers on at least two Management Servers. The
Usage Server runs at least once per day. It can be configured to run multiple
times per day.
For install Usage server
yum install
cloudstack-usage
Once installed, start the Usage Server with the following command.
Once installed, start the Usage Server with the following command.
service cloudstack-usage start
Enable the service at boot
chkconfig cloudstack-usage on
Global Paramiters need to change by requirement
In MYSQL-database there is a database
cloud_usage contain all the information with time stamp.
usage_event
usage_event_details
usage_ip_address
usage_job
usage_load_balancer_policy
usage_network
usage_network_offering
usage_port_forwarding
usage_security_group
usage_storage
usage_vm_disk
usage_vm_instance
usage_vmsnapshot
usage_volume
usage_vpn_user
user_statistics
vm_disk_statistics
Example-mysql> select * from
usage_event\G
id: 378
type: VM.CREATE
account_id: 2
created: 2015-04-06 09:27:01
zone_id: 1
resource_id: 37
resource_name: mycent1
offering_id: 27
template_id: 5
size: NULL
resource_type: XenServer
processed: 1
virtual_size: NULL
When you
what to check usage record by using api fallow the below
http://192.168.0.41:8080/client/api?command=listVirtualMachines&response=json&sessionkey=DsWC5M7cN%2B2UZE%2FM7NDVplhPKpo%3D&listAll=true&page=1&pagesize=20&_=1428328631608
(copy Url add the api call for usage like below )
Here I am generate
usage record for one account for one day.
http://192.168.0.41:8080/client/api?command=listUsageRecords&response=xml&sessionkey=P18GL7ltdP8pyMEZpgTpWfOJm1w%3D&listAll=true&page=1&pagesize=20&_=1428322026900&&&startdate=2015-04-05&enddate=2015-04-06