I have created a Dashboard in Grafana with using InfluxDB as Backend. Now I want to use my Retention Policies in Grafana.
I have following retentions:
1day -> 10 secounds Data
1 week -> 5 min Data
1 Month -> 15 min Data
3 Month -> 30 min Data
1 year -> 24h Data
my continuous query for example 1 week is:
CREATE CONTINUOUS QUERY <name> ON <database> BEGIN SELECT mean(value) AS value INTO <database>.<retention policy>.:MEASUREMENT FROM <database>.<retention policy>./.*/ GROUP BY time(5m), * END
now i want to use the retention policy one week in my dashboard with only using the time periods from grafana and dont want to change everytime the retention in the graph-query.
can someone help me please?
i dont want to change anytime the retention policy in the graphs like in the picture:
i second this. looked around in the documentation for some guidance and either i’m using the wrong keyterms or can’t find it. was sort of hoping that RPs would be transparent to external queries. i can see how in certain instances one could want to only display data from a certain RP, while in others, it would be nice to use db.* as FROM.
whatever the best practices solution is for this use case, please let us know.
…nevermind. i think i figured it out for my use case. i was under the mistaken impression that RPs had to be implemented with corresponding CQs. seeing as CQs work on DBs whereas RPs create a separate datastore, as i’m only looking to keep data for 1year, i ended up making a 1yr RP as default and just have CQs pulling from and saving to the same DB…or at least i think that’s what i did. i guess we’ll see in 24 hours.
I have a workaround. I created a variable for the Retention Policy and created a link for every Retention and set the variable via the address line.