influxdb的一些操作
curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=cadvisor" --data-urlencode "q=select * from test order by time desc"
create continous query cq_name on db_name begin select sum(count) into new_table_name from table_name group by time(30m) end
create CONTINUOUS QUERY cq_name_1 on test_db begin select sum(count) into test_db.autogen.new_table_name from cadvisor.rp_name.test group by time(1m) end
> SELECT * FROM cadvisor.rp_name.test WHERE time >= '2015-08-17T23:48:00Z' AND time <= '2025-08-18T00:30:00Z'
name: h2o_feet
time level description location water_level
---- ----------------- -------- -----------
2015-08-18T00:00:00Z between 6 and 9 feet coyote_creek 8.12
2015-08-18T00:00:00Z below 3 feet santa_monica 2.064
2015-08-18T00:06:00Z between 6 and 9 feet coyote_creek 8.005
2015-08-18T00:06:00Z below 3 feet santa_monica 2.116
2015-08-18T00:12:00Z between 6 and 9 feet coyote_creek 7.887
2015-08-18T00:12:00Z below 3 feet santa_monica 2.028
2015-08-18T00:18:00Z between 6 and 9 feet coyote_creek 7.762
2015-08-18T00:18:00Z below 3 feet santa_monica 2.126
2015-08-18T00:24:00Z between 6 and 9 feet coyote_creek 7.635
2015-08-18T00:24:00Z below 3 feet santa_monica 2.041
2015-08-18T00:30:00Z between 6 and 9 feet coyote_creek 7.5
2015-08-18T00:30:00Z below 3 feet santa_monica 2.051
insert h2ofeet,location=coyote_creek level="between 6 and 9",description="feet",water_level=7.5
insert cadvisor.autogen.h2ofeet,location=santa_monica level="below 3 feet",description="feet",water_level=2.051
SELECT mean("water_level") FROM "h2ofeet" WHERE time >= '2015-08-17T23:48:00Z' AND time <= '2020-10-18T00:30:00Z' GROUP BY time(12m),* fill(200) LIMIT 7 SLIMIT 1
name: h2ofeet
time description level location water_level
---- ----------- ----- -------- -----------
1600774193804526019 feet between 6and 9 coyote_creek 8.12
1600774228677580618 feet below 3 santa_monica 2.064
1600774250253841400 feet between 6 and 9 coyote_creek 8.005
1600774277549749448 feet below 3 feet santa_monica 2.116
1600774299892419152 feet between 6 and 9 coyote_creek 7.887
1600774309539527057 feet below 3 feet santa_monica 2.028
1600774319051489554 feet between 6 and 9 coyote_creek 7.762
1600774332548513007 feet below 3 feet santa_monica 2.126
1600774343252750799 feet between 6 and 9 coyote_creek 7.635
1600774353307772223 feet below 3 feet santa_monica 2.041
1600774363779354770 feet between 6 and 9 coyote_creek 7.5
1600774372020556482 feet below 3 feet santa_monica 2.051
SELECT mean("water_level") FROM "h2ofeet" GROUP BY location
SELECT mean("water_level") FROM "h2ofeet" WHERE time >= '2020-09-22T11:20:00Z' AND time <= '2020-09-22T11:40:00Z' GROUP BY time(50s)
SELECT INTEGRAL("water_level") FROM "h2ofeet" WHERE time >= '2020-09-22T11:20:00Z' AND time <= '2020-09-22T11:40:00Z'
CUMULATIVE_SUM
SELECT CUMULATIVE_SUM("water_level") FROM "h2ofeet" WHERE time >= '2020-09-22T11:20:00Z' AND time <= '2020-09-22T11:40:00Z'
name: h2ofeet
time mean
---- ----
1600774150000000000 8.12
1600774200000000000 2.064
1600774250000000000 6.002666666666666
1600774300000000000 4.88775
1600774350000000000 3.8640000000000003
1600774400000000000
1600774450000000000
1600774500000000000
1600774550000000000
1600774600000000000
1600774650000000000
1600774700000000000
1600774750000000000
1600774800000000000
1600774850000000000
1600774900000000000
1600774950000000000
本文地址:https://blog.csdn.net/ma_ru_long/article/details/108978582