Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Abiquo kinton schema contains triggers for accounting integration. The triggers run stored procedures in the kinton_accounting schema to automatically capture data in if/then/when scenarios.

ResourceTriggers
VMs

update_virtualmachine_update_stats

AFTER

UPDATE

ON

virtualmachine

Storage

create_rasd_management_update_stats

AFTER

INSERT

ON

rasd_management

delete_rasd_management_update_stats

AFTER

DELETE

ON

rasd_management

IPs

update_ip_pool_management_update_stats

AFTER

UPDATE

ON

ip_pool_management

update_rasd_management_update_stats

AFTER

UPDATE

ON

rasd_management

VLANs

create_vlan_network_update_stats

AFTER

INSERT

ON

vlan_network

delete_vlan_network_update_stats

AFTER

DELETE

ON

vlan_network

Racks

rack_update

AFTER

UPDATE

ON

rack

Physical Machines

physicalmachine_create

AFTER

INSERT

ON

physicalmachine

physicalmachine_delete

AFTER

DELETE

ON

physicalmachine

physicalmachine_update

AFTER

UPDATE

ON

physicalmachine

VM templates

virtualimage_create

AFTER

INSERT

ON

virtualimage

virtualimage_delete

AFTER

DELETE

ON

virtualimage

virtualimage_update

AFTER

UPDATE

ON

virtualimage

virtualimageconversion_update

AFTER

UPDATE

ON

virtualimage_conversion


Stored procedures for event accounting

The triggers collect the information necessary and call stored procedures responsible for recording accounting events. The stored procedures are:

Code Block
AccountingVMRegisterEvents
AccountingStorageRegisterEvents
AccountingIPsRegisterEvents
AccountingVLANRegisterEvents


...

Accounting tables

This section gives a general description of the accounting tables.

Warning

The accounting_event_"resource" tables are the definitive source of accounting data and log of customer activity. You must back up these tables to prevent accidental loss of accounting data. The default for removing stale data from these tables is 3 years. If you upgraded to Abiquo 2.4 and you were using default values, they were updated to 3 years. However, non-default values were not updated in the upgrade to Abiquo 2.4.

...

Table accounting_event_vm

...


Field name

Field type

Description

idVMAccountingEvent

BIGINT

ID event unique

idVM

INTEGER

ID of virtual machine owning the resource

idEnterprise

INTEGER

ID of enterprise resource owner

idVirtualDataCenter

INTEGER

ID of virtual datacenter facility owner

idVirtualApp

INTEGER

ID virtual app resource owner

cpu

INTEGER

'cores' units

ram

INTEGER

Memory, in megabytes (MB)

hd

BIGINT

Local storage, in bytes (B)

startTime

TIMESTAMP

When a resource was created

stopTime

TIMESTAMP

When a resources was destroyed

consolidated

TINYINT

Flag for processed or not

costCode

TINYINT

Cost code assigned for pricing purposes

hypervisorType

VARCHAR

The type of hypervisor hosting the virtual machine

idDataCenterINTEGERID of datacenter
VirtualMachine-haHostedINTEGER(minus) Deprecated - Flag for hosted on HA-enabled PM or not (haEnabled)
antiAffinityINTEGERFor VMs in an anti-affinity layer
idHardwareProfileINTEGERID of hardware profile

...

This table stores details of reserved physical servers - one row for each reserved server.

...


Field nameField typeDescription
idPMAccountingEventBIGINTUnique column identifier for the accounting event
idPhysicalMachineINTID of the physical machine, as defined in the kinton.physicalmachine table.
NOTE: Use the kinton_accounting ABQ_PM_ID_TO_NAME(id) function to obtain the machine name associated with the ID
idEnterpriseINTID of the ENTERPRISE, as defined in the kinton.enterprise table.
NOTE: Use the kinton_accounting ABQ_ENT_ID_TO_NAME(id) function to obtain the machine name associated with the ID
cpuINTThe number of physical CPUs in the machine
ramINTThe physical machine’s RAM (in MB)
startTimeTIMESTAMPThe time at which the machine reservation started
stopTimeTIMESTAMPThe time at which the reservation finished.   This value is NULL if the reservation is still active
idDataCenterINTID of the physical datacenter, as defined in the kinton.datacenter table.
NOTE: Use the kinton_accounting ABQ_DC_ID_TO_NAME(id) function to obtain the datacenter name associated with the ID
consolidatedTINYINTIndicates whether this row has been consoliated with other rows.   Currently this value is always 0
version_cINTSoftware controlled data version

 


Table accounting_event_repository

This table contains details of the repository usage. There is one row for each VM Template and Instance stored in the repository. Persistent VM templates are not included in this table, because they are stored as external volumes and charged separately.


 

Field nameField typeDescription
idRepoAccountingEventBIGINTUnique column identifier for the accounting event
idImageINTID of the repository image, as defined in the kinton.virtualimage table.
NOTE: Use the kinton_accounting ABQ_IMG_ID_TO_NAME(id) function to obtain the image name associated with the ID
idEnterpriseINTID of the ENTERPRISE, as defined in the kinton.enterprise table.
NOTE: Use the kinton_accounting ABQ_ENT_ID_TO_NAME(id) function to obtain the machine name associated with the ID  
idImageTypeNameINTThe ID of the image type name in the generic accounting name table, use the kinton_accounting ABQ_OBJECT_ID_TO_NAME (id)  function to retrieve the actual type name.   Names are one of:
INSTANCE, TEMPLATE, INSTANCE-CONVERSION, TEMPLATE-CONVERSION
idImageFormatNameINTThe ID of the image format name in the generic accounting name table, use the kinton_accounting ABQ_OBJECT_ID_TO_NAME (id)  function to retrieve the actual format name.   Names are: VMDK_FLAT, RAW, etc. see the wiki API reference for further details
imageSizeBIGINTPhysical size of the repository image, in bytes
idRepositoryINTThe ID of the image repository as defined in the kinton.repository table
idRepositoryNameINT(minus) Deprecated - The ID of the repository name in the generic accounting name table, use the kinton_accounting ABQ_OBJECT_ID_TO_NAME (id)  function to retrieve the actual repository name. THIS FIELD WAS DEPRECATED IN ABIQUO 3.4
startTimeTIMESTAMPThe time at which the image was created in the repository
stopTimeTIMESTAMPThe time at which the image was deleted from the repository.  This value is NULL if the image still exists.
idDataCenterINTID of the physical datacenter, as defined in the kinton.datacenter table.
NOTE: Use the kinton_accounting ABQ_DC_ID_TO_NAME(id) function to obtain the datacenter name associated with the ID.  
consolidatedTINYINTIndicates whether this row has been consoliated with other rows.   Currently this value is always 0.
version_cINTSoftware controlled data version.


List of accounting event tables

The accounting event tables include the following.

  • backup
  • ds_storage
  • firewall
  • ips
  • loadbalancer
  • pm
  • protect
  • repository
  • storage
  • vlan
  • vm
  • vm_off
  • vm_on

...

  • Cores
  • RAM
  • Local storage
  • Cost codes (if the VM template has a cost code)

    NoteGrouped (warning) Grouped virtual machine components and virtual machines are accounted per group, not per individual virtual machine.


2. Virtual appliance

  • Groups of virtual machines
    • Cores
    • RAM
    • Local storage
    • Cost codes (if the VM template has a cost code)

      NoteGrouped (warning) Grouped virtual appliances are accounted per group, not per individual virtual appliance.


3. Virtual datacenter

  • Groups of virtual machines
  • Groups of virtual appliances
    • Cores
    • RAM
    • Local storage
    • VLANS
    • Public IPs
    • External storage

      NoteVirtual (warning) Virtual Datacenter accounting is the total of the resources reserved and/or consumed by the Virtual Machines, Virtual Appliances, and users of a Virtual Datacenter.


4. Enterprise
An Enterprise has no managed resources that do not belong to a Virtual Datacenter, so there is no accounting per Enterprise. However, the Enterprise associated with each resource is recorded for aggregating resources at Enterprise level, and this information can be retrieved through the database views. 


...

Legacy accounting views

For accounting and billing, Abiquo has previously implemented database views (in both the kinton and kinton_accounting schemas) to help you access the resource usage information correctly. However, the use of these views is no longer recommended for scalability and performance reasons. Instead, use the equivalent queries described above.

...

  • ACCOUNTING_CONFIG_VW  - Returns the current accounting configuration as a single row

...