Changing retention period for metrics
Extending retention period increases the Gnocchi database size insignificantly compared to its default value.
You can change the retention period for metrics through an archive policy. By default, the ceilometer-low-rate
and low
policies are used to store metrics. Note that you cannot change the metering granularity for these policies.
To show the details of a particular archive policy
Use the gnocchi archive-policy show
command. For example:
# gnocchi --insecure archive-policy show ceilometer-low-rate +---------------------+---------------------------------------+ | Field | Value | +---------------------+---------------------------------------+ | aggregation_methods | rate:mean, mean | | back_window | 0 | | definition | - points: 8640, granularity: 0:05:00, | | | timespan: 30 days, 0:00:00 | | name | ceilometer-low-rate | +---------------------+---------------------------------------+
In the output:
- 8640 points shows how many aggregates will be retained
- the granularity of 5 minutes defines the time between two aggregates
- the timespan of 30 days specifies the retention period for aggregates
To sum it up, metrics with the ceilometer-low-rate
policy will keep 8640 computed aggregates for one month with 5-minute granularity.
To change the policy definition
Use the gnocchi archive-policy update
command. To calculate the correct number of points required for the desired timespan, refer to this formula:
points = timespan \ granularity
For example, to keep aggregates for 2 months with the 5-minute granularity, specify 17280 points:
# gnocchi --insecure archive-policy update ceilometer-low-rate \ -d points:17280,granularity:0:05:00,timespan:60d +---------------------+----------------------------------------+ | Field | Value | +---------------------+----------------------------------------+ | aggregation_methods | rate:mean, mean | | back_window | 0 | | definition | - points: 17280, granularity: 0:05:00, | | | timespan: 60 days, 0:00:00 | | name | ceilometer-low-rate | +---------------------+----------------------------------------+