Reputation: 169
Can someone please point out what I am doing wrong in my command below which gives the error shown below?
Command:
eCollection=( $(cut -d ',' -f2 new.txt ) )
start= date --utc +%FT%T.%2NZ
sleep 10
end= date --utc +%FT%T.%2NZ
for i in "${eCollection[@]}"
do
var=$((var+1))
if [[ $var -gt 1 ]] ; then
curl -G 'http://localhost:8086/query?db=telegraf' --data-urlencode \
'q=SELECT * FROM '$i' WHERE "time" >= $timebegin AND "time" \
<= $timeend' --data-urlencode \
'params {"timebegin":"${start}","timeend":"${end}"}'
fi
done
Error:
{"results":[{"statement_id":0,"error":"invalid operation: time and *influxql.StringLiteral
are not compatible"}]}
Upvotes: 1
Views: 3031
Reputation: 169
Here is an update that has to do with working with strings
start=$(date --utc +"%FT%T.%2NZ")
sleep 100
end=$(date --utc +"%FT%T.%2NZ")
startCall='"'$start'"'
endCall='"'$end'"'
echo "$startCall"
echo "$endCall"
for i in "${eCollection[@]}"
do
var=$((var+1))
if [[ $var -gt 1 ]] ; then
echo ${i}
curl -G 'http://localhost:8086/query?db=telegraf' --data-urlencode 'q=SELECT * FROM '$i' WHERE "time" >= $timebegin AND "time" <= $timeend' \
--data-urlencode 'params={"timebegin":'$startCall', "timeend": '$endCall'}'
fi
done
Upvotes: 1