Delete values from influxdb

Quick (and dirty) tip and script to remove unwanted or incorrect values from influxdb.
Precisely, this one removes all values above 50 fromArkteosreg3_exterieur_temp.

#!/bin/sh
influx -database 'openhab3_db' -host 'localhost' -port '8086' -username 'admin' -password '' -execute 'select * from Arkteosreg3_exterieur_temp where value > 50' | awk '{print $1;}' > /tmp/time.txt
while read -r line; do echo "$line";influx -database 'openhab3_db' -host 'localhost' -port '8086' -username 'admin' -password '' -execute "delete from Arkteosreg3_exterieur_temp where time=$line"; done < /tmp/time.txt

 

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *