Continuous query not able to populate data

influxql
#1

i have created a continous query, for aggregrating data from cloudwatch, the query triggers successfully, but is not storing the data , but if i run the same query by capturing from the influx logs the query is writing the data, any help is appreciated

In the logs i can see the query
ts=2019-01-21T17:24:00.207572Z lvl=info msg=“Executing query” log_id=0D32u3iW000 service=query query=“SELECT mean(cpu_utilization_average) AS cpu_utilization, mean(disk_read_ops_average) AS disk_read_ops, mean(disk_write_ops_average) AS disk_write_ops INTO monitoring_bmp_agg.bmp_agg_policy.ec2_stats FROM monitoring_bmp.bmp_retention_policy.cloudwatch_aws_ec2 WHERE cluster_name != ‘’ AND time >= ‘2019-01-21T17:18:00Z’ AND time < ‘2019-01-21T17:24:00Z’ GROUP BY cluster_name, time(6m)”

but the data doesn’t get inserted, if i copy and run the same query in the shell data gets inserted successfully

#2

Hi ,
can you share the script that you use to create the continues query ?
best regards

#3

Thanks for the reply MarcV, i changed the syntax of creating the continuous query from the basic group by time(), to the advance syntax by using the resample, with for and interval , it is running fine now

fyi
old query (the problem one)
CREATE CONTINUOUS QUERY ec2_6_minute_stats ON monitoring_bmp BEGIN SELECT mean(cpu_utilization_average) AS cpu_utilization, mean(disk_read_ops_average) AS disk_read_ops, mean(disk_write_ops_average) AS disk_write_ops INTO monitoring_bmp_agg.bmp_agg_policy.ec2_stats FROM monitoring_bmp.bmp_retention_policy.cloudwatch_aws_ec2 where cluster_name != ‘’ GROUP BY cluster_name, time(6m) END

new query(running fine)
CREATE CONTINUOUS QUERY ec2_10_minute_stats ON monitoring_bmp
RESAMPLE EVERY 5m FOR 15m
BEGIN
SELECT mean(cpu_utilization_average) AS cpu_utilization INTO
monitoring_bmp_agg.bmp_agg_policy.ec2_stats FROM
monitoring_bmp.bmp_retention_policy.cloudwatch_aws_ec2 where cluster_name != ‘’ GROUP BY cluster_name, time(5m) order by time desc
END