Change the accounting configuration parameters

There are two types of accounting parameters:

  1. Resource parameters to enable or disable the accounting of resource usage in Abiquo

  2. Configuration parameters to change the configuration of accounting

This page describes the configuration parameters and how to change them.

Get the accounting configuration parameters

The accounting configuration parameters are stored in the accounting_parameters table in the kinton_accounting database together with the 

See Abiquo accounting services integration for examples of basic queries to list the accounting parameter and how to update the resource parameters.

Table of accounting configuration parameters

You can set these configuration parameters in the kinton_accounting.accounting_parameters table.

Name

Default

value

Description

Name

Default

value

Description

AccountingEnabled

1

Controls if the accounting functionality is active or not.

0 or no parameter means do not calculate rows to add into the accounting_event_detail table. A non-zero value means that the accounting process is active.

DeleteRegEventsUseSPParam

0

Controls if DeleteOldRegisteredEvents uses its parameter value instead of DeleteRegEventsDeleteHours to control the age of data in accounting_event master tables.
Default value is 0, using DeleteRegEventsDeleteHours as record maximum age.

DeleteRegEventsDeleteHours

26280

This controls the number of hours worth of 'old' data that should be held in the accounting_event_... tables.

When DeleteOldRegisteredEvents is run, it will remove any rows from the tables which are inactive and older than the specified number of hours.

The default value of 26280 hours means that data is held for approximately 3 years by default (three years of 365 days).

AccountPeriodSize

HOUR

Controls the size of the aggregated account period of the accounting_event_detail table.

It may be one of the following values: HOUR, DAY, WEEK, MONTH. If the value is bad or missing, the default value is used.

AccountPeriodGranularity

HOUR

Controls the granularity of an accounting period, i.e. how many resource units are recorded. For example:

  • if account period = DAY and granularity = HOUR, then for a single CPU VM, Abiquo would record 24 resource units for the period;

  • if account period = DAY and granularity = DAY, then Abiquo would record 1 resource unit.

Possible values are HOUR, DAY, WEEK and MONTH. If the value is bad or missing, the default value is used.

MaximumPeriodsToFirstInit

1

This parameter is only used when accounting_event_detail is empty. It determines how many previous accounting periods will be used to populate the accounting initially.

The default value is 1, which means that accounting data will be generated from the last period.

However, for existing installations this value can be adjusted to ensure that accounting is generated for any previous number of hours, days, weeks, or months, depending on the account period size.

The minimum number of periods is 1, and the maximum is 720. Values outside of this range will use the default value of 1.

MaximumPeriodsToProcess

24

This parameters controls how many periods will be processed in each call to the UpdateAccounting stored procedure.

This setting ensures a degree of quality of service for the DBMS, minimizing the resource impact of recovering missed accounting data.

The default value is 24, which would process 1 day of accounting data, assuming the default settings for other parameters.

The minimum number of periods to process is 1, and the maximum is 720 - if a value outside of this range is supplied, then the default value of 24 is used.

Consolidation-time-sensitivity-secs

30

Abiquo registers an accounting event with the desired values for each configuration change.

The accounting consolidation process will apply the maximum values found in a period, even if they were only registered for a short time, for example, because of an error.

This parameter will make the consolidation process ignore all accounting events that were only active for a small user-defined amount of time.The default value is 30 seconds, which should be enough to skip short events

Change the accounting period

To change the accounting period or other accounting parameters in an existing system, do these steps: 

  1. Backup the accounting_event_detail table.

  2. Delete the existing content of the accounting_event_detail table.

  3. Change the accounting parameters to the desired values. Set MaximumPeriodsToFirstInit to ensure old data is accounted correctly.

  4. Monitor the content of accounting_event_detail to ensure the generated data meets your needs. If not, then repeat from step 2.

Set the account period size

The AccountPeriodSize parameter controls the minimum usage time of resources.

It sets the length of the accounting period. For each accounting period, the update procedure checks the Accounting event tables for resources that have been reserved and/or used in the last period by granularity and records the usage data in the accounting_event_detail table.

The minimum period of consumption of a resource is always one accounting period. If a resource is active for an interval of less than one accounting period, the system automatically rounds consumption up to one accounting period. But the value that accounting stores will depend on the granularity.

Users can turn resources on and off (again) during an accounting period. Abiquo stores all these events in the Accounting master tables. However, accounting_event_detail only contains the maximum value for an accounting period.

You can set the accounting period size parameter in the accounting_parameters table.

Parameter

Default value

Possible values

Description

Parameter

Default value

Possible values

Description

AccountPeriodSize

HOUR

HOUR

DAY

WEEK

MONTH

Controls the size of the aggregated account period of the accounting_event_detail table.

If the value is bad or missing, the default value of 1 hour is used.



For example, to change the accounting period to a day.

UPDATE accounting_parameters SET paramValue="DAY" WHERE paramName="AccountPeriodSize";

Set the granularity

For each accounting period, the Update procedure checks the master tables for resources reserved and/or consumed in the last period by granularity  and records the usage data in the Accounting event detail table.

You can use the granularity to divide the value stored for each accounting period into smaller time units. However, the granularity does not affect the minimum usage.

The minimum period of usage is always determined by the accounting period:

  • If accounting period = DAY and granularity = HOUR, then for a single CPU VM, Abiquo would record 24 resource units for a day record. So this could represent a charge for 24 hours of vCPU usage.

  • If accounting period = DAY and granularity = DAY, then Abiquo will record 1 resource unit. So this could represent a charge for 1 day of vCPU usage.

You can set the granularity parameter in the accounting_parameters table.



Default value

Possible values

Description



Default value

Possible values

Description

AccountPeriodGranularity

HOUR

HOUR

DAY

WEEK

MONTH

Granularity of the resource units within an accounting period.

If the value is bad or missing, the default value is used.

The granularity must be smaller than the accounting period and the accounting period must be divisible by the granularity.

The following table shows compatible periods and granularities. Abiquo uses calendar months, so week granularity is not compatible with month.







Period

Hour

Day

Week

Month

Granularity







Hour

Day



Week







Month








For example, to set the accounting period granularity to day.

We assume that the account period size is set to WEEK:

UPDATE accounting_parameters SET paramValue="DAY" WHERE paramName="AccountPeriodGranularity";

Check the updated value by using the select command.

Change how often accounting deletes old records

To change the maximum record age of the accounting master table records, set the DeleteRegEventsDeleteHours parameter in accounting_parameters table as desired. 

It is also possible to use the stored procedure parameter as maximum record age by enabling the DeleteRegEventsUseSPParam parameter in accounting parameters, but it is not recommended to use this method.

For example, to keep the data for 2 years instead of the default of 3 years.

UPDATE accounting_parameters SET paramValue="17520" WHERE paramName="DeleteRegEventsDeleteHours";

 

Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved