WAS THIS PAGE HELPFUL? Leave Feedback
Overview
An InfluxDB data retention policy applies across all measurements stored in an InfluxDB database. Data in the GroundWork InfluxDB databases older than this will automatically be deleted by InfluxDB. The default retention policy for GroundWork InfluxDB databases is 56 weeks of raw data. This was chosen as the default to allow annual reporting and comparison to the current date and one year past. This aids in spotting annual patterns. You can create and use new retention policies easily. See examples below and the InfluxData documentation Downsampling and Retention for more information on altering retention policies.
Examples
Example of viewing existing retention polices
- To view the existing retention policies for the groundwork database, enter the following command:
/usr/local/groundwork/influxdb/bin/influx -execute 'show retention policies on "groundwork"'
You should see something similar to this:
name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 0s 168h0m0s 1 false groundwork_56_weeks 9408h0m0s 168h0m0s 1 true
Example of creating a new default retention policy
- To create a new 10 week retention policy on the groundwork database and make this policy the new default, enter the following command:
/usr/local/groundwork/influxdb/bin/influx -execute 'create retention policy "groundwork_10_weeks" on "groundwork" duration 10w replication 1 default'
- Viewing with the first command from above, you should see something similar to this:
name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 0s 168h0m0s 1 false groundwork_56_weeks 9408h0m0s 168h0m0s 1 false groundwork_10_weeks 1680h0m0s 24h0m0s 1 true
Example of changing the default retention policy
- To switch the default retention policy on the groundwork database to the groundwork_56_weeks policy, enter the following command:
/usr/local/groundwork/influxdb/bin/influx -execute 'alter retention policy "groundwork_56_weeks" on "groundwork" default'
- Viewing with the first command from above, you should see something similar to this:
name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 0s 168h0m0s 1 false groundwork_56_weeks 9408h0m0s 168h0m0s 1 true groundwork_10_weeks 1680h0m0s 24h0m0s 1 false
Example of updating retention policy to include RRD data
- Migrating RRDs to Influx DB:
- From the scripts sub-directory run grafbridge-control -import_rrds:
cd /usr/local/groundwork/grafana/scripts
./grafbridge-control -import_rrds
- Output shows (based on policy rejected):
REJECTED input RRD data based on retention policy from:01/15/2017 10:00:00 to:04/18/2017 08:43:36
- From the scripts sub-directory run grafbridge-control -import_rrds:
- Run the following command to show retention policies:
/usr/local/groundwork/influxdb/bin/influx -execute 'show retention policies on "groundwork"'
- Output shows:
name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 0s 168h0m0s 1 false groundwork_56_weeks 9408h0m0s 168h0m0s 1 true
- Output shows:
- Run the import command again to show match and policy:
./grafbridge-control -import_rrds
- Output shows:
[Wed May 16 11:24:35 2018] Processing RRD's for host daptiv-dev service icmp_ping_alive [Wed May 16 11:24:35 2018] REJECTED input RRD data based on match to existing influxDB data from:04/19/2017 10:00:00 [Wed May 16 11:24:35 2018] REJECTED input RRD data based on retention policy from:01/15/2017 10:00:00 to:04/19/2017 11:24:35
- Output shows:
- Create retention policy to include RRD data:
- Using the date to date calculation page, key in for example 01/15/2017 to 05/16/2018 (time now). Then use the hrs value to update the retention policy. For example you want to include the values: 01/15/2017 to 05/16/2018 (time now), which displays:
- 11,712 hrs
- 488 days
- 69 weeks 5 days
- To create a new default retention policy, you need to consider when you will run import_rrds again because retention is based on run date - retention value. Here we use 70 weeks:
/usr/local/groundwork/influxdb/bin/influx -execute 'create retention policy "groundwork_70_weeks" on "groundwork" duration 70w replication 1 default'
- Using the date to date calculation page, key in for example 01/15/2017 to 05/16/2018 (time now). Then use the hrs value to update the retention policy. For example you want to include the values: 01/15/2017 to 05/16/2018 (time now), which displays: