Influx Data Loss after implementing Retention

Hi
I did implement Influx retention on our icinga Server according to Retention policies and continuous queries made simple

But after some days, i recognized all data in flux DB is deleted one week back.
I did following changes on the Database:

CREATE RETENTION POLICY "rp_2_years" ON "icinga2" DURATION 104w REPLICATION 1
CREATE RETENTION POLICY "rp_3_years" ON "icinga2" DURATION 156w REPLICATION 1

CREATE CONTINUOUS QUERY "cq_after_1_year" ON "icinga2" BEGIN SELECT mean(value) AS value,mean(crit) AS crit,mean(warn) AS warn INTO "icinga2"."rp_2_years".:MEASUREMENT FROM "icinga2"."default"./.*/ WHERE time < 'now()-52w' GROUP BY time(1h),* END

CREATE CONTINUOUS QUERY "cq_after_2_year" ON "icinga2" BEGIN SELECT mean(value) AS value,mean(crit) AS crit,mean(warn) AS warn INTO "icinga2"."rp_3_years".:MEASUREMENT FROM "icinga2"."rp_2_years"./.*/ WHERE time < 'now()-104w' GROUP BY time(1d),* END

ALTER RETENTION POLICY "default" ON "icinga2" DURATION 52w DURATION 168h

Which result in the following printouts:

> SHOW CONTINUOUS QUERIES
name: _internal
---------------
name	query


name: icinga2
-------------
name		query
cq_after_1_year	CREATE CONTINUOUS QUERY cq_after_1_year ON icinga2 BEGIN SELECT mean(value) AS value, mean(crit) AS crit, mean(warn) AS warn INTO icinga2.rp_2_years.:MEASUREMENT FROM icinga2."default"./.*/ WHERE time < 'now()-52w' GROUP BY time(1h), * END
cq_after_2_year	CREATE CONTINUOUS QUERY cq_after_2_year ON icinga2 BEGIN SELECT mean(value) AS value, mean(crit) AS crit, mean(warn) AS warn INTO icinga2.rp_3_years.:MEASUREMENT FROM icinga2.rp_2_years./.*/ WHERE time < 'now()-104w' GROUP BY time(1d), * END

> SHOW RETENTION POLICIES ON icinga2
name		duration	replicaN	default
default		168h0m0s	1		true
rp_3_years	26208h0m0s	1		false
rp_2_years	17472h0m0s	1		false
> 

I was struggling on the Queries above, because we run a quite old version of influxDB - 0.10.0

Can someone show me my mistakes? :see_no_evil:

Thank you very much! A

Hi,

from a quick read I think your changes are alright. I ran into the same “issue” a while back, you need to modify your queries in Grafana. You have to select rp_2_years or rp_3_years in the first field where now default is entered (first “box” in the query builder).

Best regards
Michael

Hi Michael
Thank you for for fast reply!
Indeed, i got different resolutions in my Grafana dashboard!
See the Printscreens:
Ping 1min


Ping 1 hour

Ping 1 day

But no data is older 10. August 2020. I can verify this, on the disk usage on the Influx Server!
I would suggest, that i can use one retention Policy in Grafana, which is less accurate after one year.
The “inaccurate” data is current data, not the old one.
I think i am wrong with my thoughts of retention, or i did something wrong with the queries above!?