From eb8a030966f322e019a0a1f429279f6834022dfc Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Wed, 30 Jun 2021 17:41:38 -0400 Subject: [PATCH] reset vars in jinja loop --- salt/common/tools/sbin/so-influxdb-downsample | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/salt/common/tools/sbin/so-influxdb-downsample b/salt/common/tools/sbin/so-influxdb-downsample index b561d2b6a..ab8fa1dc0 100755 --- a/salt/common/tools/sbin/so-influxdb-downsample +++ b/salt/common/tools/sbin/so-influxdb-downsample @@ -25,12 +25,13 @@ echo -e "\nInfluxDB will now be downsampled. This could take a few hours dependi read -r -p "Are you sure you want to continue? [y/N] " yorn if [[ "$yorn" =~ ^([yY][eE][sS]|[yY])$ ]]; then echo -e "\nMigrating InfluxDb started at `date`. This may take several hours depending on how much data needs to be downsampled." - day=0 - startdate=`date` + {% for dest_rp in influxdb.downsample.keys() %} {% for measurement in influxdb.downsample[dest_rp].get('measurements', []) %} + day=0 + startdate=`date` while docker exec -t so-influxdb /bin/bash -c "influx -ssl -unsafeSsl -database telegraf -execute \"SELECT mean(*) INTO \"so_long_term\".\"{{measurement}}\" FROM \"autogen\".\"{{measurement}}\" WHERE \"time\" >= '2020-07-21T00:00:00.0000000Z' + ${day}d AND \"time\" <= '2020-07-21T00:00:00.0000000Z' + $((day+1))d GROUP BY time(5m),*\""; do # why 2020-07-21? migrationdate=`date -d "2020-07-21 + ${day} days" +"%y-%m-%d"`