Тёмный

Flux query language and Influxdb basics 

Csongor Varga
Подписаться 36 тыс.
Просмотров 39 тыс.
50% 1

In order to understand some of my future videos coming, I wanted to lay the basics of InfluxDB and Flux query language. I go into how Flux 2.x differs from 1.x and also traditional SQL, what the data structure looks like and how to build simple queries in Flux.
Wiki documentation on Influx setup: github.com/nygma2004/km/wiki/...
My video on the new server build: • New Node-Red server
Influxdb, Telegraf and Grafana setup: • InfluxDB 2.1, Grafana ...
Chapters:
0:00 Intro
0:43 1.x and 2.x, databases, buckets and retention policies
5:45 Measurements, tag and fields
11:16 Time window and aggregation period
13:22 How data is filtered
20:48 Flux query language
37:10 Outro

Наука

Опубликовано:

 

29 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 42   
@BGazzah
@BGazzah 2 года назад
Another great vid - I am building up a new NUC to hold mainly node-red, influx and grafana. I have an older v1.x influx with several years worth of data that I may try and transfer. So good timing on your part :)
@StephenRerri-Bekibele
@StephenRerri-Bekibele Месяц назад
Great video! thank you for the insightful knowledge into how the query builder generates code for you if you are not sure how to write the flux equivalent.
@someone_there
@someone_there 2 года назад
I am glad I found your video, cause now I understood a bit more about the influxdb queries, however I think there is still a lot of hesitation/mistakes that are slightly degradating the comprehension of the video, that's a point for improvement. Thanks a lot for your time and explanations! 👍
@miketancsa
@miketancsa 2 года назад
Great intro video! I have been doing a deep dive into influx DB 2.x, telegraf, grafana etc and it took me a while to get my bearings coming from just a SQL background. One note about the video, the image of you narrating obscures the bottom right corner of the panel which is important to see :)
@tomekem3473
@tomekem3473 2 года назад
Great content. I'm going to switch from 1.x to 2.x and this is very useful for me. Keep going :)
@jackbenimble999
@jackbenimble999 2 года назад
Thanks! the SQL comparisons are especially helpful.
@pratyush__agarwal
@pratyush__agarwal Год назад
Nicely explained, great video 👍
@niyantazamindar4019
@niyantazamindar4019 2 года назад
Hello, I have a query: If the values in left most column "table MEAN" represent mean of the window, how can mean be 0 (15:08 timestamp in video). Also, if I don't have any aggregate function in place, the column becomes "table _RESULT" and has int values (0, 3) [my local db]. What do they represent?
@archilizer2946
@archilizer2946 2 года назад
Finally, some good content for novice users. Garbage training materials from influxdb, very frustrating start... Thank you kindly, Sir.
@shashiranjan7451
@shashiranjan7451 3 месяца назад
Very nice video. Keep it up!!
@jafarekrami
@jafarekrami 2 года назад
Good Job! please continue and do something with influx 1.x also.
@csongorvarga
@csongorvarga 2 года назад
Sorry, it takes a lot of time to get my head around 2.x, I have no intention to go back to a version which is not supported any more.
@nor505
@nor505 Год назад
Hello Csongor! Nice video as always from you! In one of your earlier video I saw you installed esphome without home assistant on one of your iot device. My question is whether you could send datas from esphome to influxdb. I am not sure, but as far as I know influxdb plugin for esphome is not existent. You can disable the standard api of esphome and change to mqtt and then you can use a mqtt->influxdb connector to send data from esphome to influxdb. However, I think it is not am elegant way. Do you have any experience about that. Thanks for your answer.
@csongorvarga
@csongorvarga Год назад
If I remember correctly, I tried looking into it. To be honest since I have Node-Red I do everything via Node-Red. But it is possible to set up Telegraf to subscribe to MQTT topics and push the data to influx. Maybe this post can help: github.com/influxdata/telegraf/blob/master/plugins/inputs/mqtt_consumer/README.md
@aaaliasx
@aaaliasx 2 года назад
Thanks for a great tutorial Csongor Varga,! Is your bucket mydb available anywhere? Thought it would help a lot if I can have the same data setup locally when I wath the different chapters in the video
@csongorvarga
@csongorvarga 2 года назад
Not, but I am not sure how I could export it... never done that before
@gabrielarispe7703
@gabrielarispe7703 2 года назад
hi men good video, an question is there a way to get the number of rows returned by a query?
@csongorvarga
@csongorvarga 2 года назад
Sure, you can use the count() function.
@satishkamma8493
@satishkamma8493 Год назад
In influxdb is it possible to find which exact query,index,measurement using high memory or cpu in percentage wise. Is there any document along with commands/syntax for checking these. can you help on this
@csongorvarga
@csongorvarga Год назад
That is a good question. Sorry I have no idea, I probably have to research this.
@azrinbaharin9630
@azrinbaharin9630 2 года назад
hi .. may i know how to do query database for influx for speceifi date and time . let say query from 1jan2022 8am to 2jan2022 8am
@csongorvarga
@csongorvarga 2 года назад
Just use the range function and you can just specify the start and end date directly. For example: |> range(start: 2018-05-22T23:30:00Z, stop: 2018-05-23T00:00:00Z)
@user-st8to1ux2b
@user-st8to1ux2b 11 месяцев назад
Hi, I just want to know how you are writing the data into the influxdb. If you can share the that file, it will be very helpful
@csongorvarga
@csongorvarga 11 месяцев назад
I post data from Node-Red, and I use the line protocol to inject the data. I am showing this is all my other videos.
@MatSmithLondon
@MatSmithLondon 11 месяцев назад
This was really useful, especially the bit about deleting Influx data. I'm using Node-RED to send data from multiple current clamp sensors (Emporia, data collected in HA). I have a function node that just takes the MQTT topic and converts it into an object key, with the number as the value. However for some reason, one of the sensors gives an error: failure writing points to database: partial write: field type conflict: input field "empty_10_1min" on measurement "emporia_power" is type float, already exists as type string dropped=1". So obviously some time in the past it has written a string, and so that measurement type is a string. I thought I could just delete all the data in that field by running the delete command, but that doesn't seem to work. Is there a way to fully delete a field itself (not just the data within the field)?
@csongorvarga
@csongorvarga 11 месяцев назад
Yes, I had similar issue in the past, and I had to delete data as well. You can delete data for an entire measurement or entire field. So it really depends how to save the data.
@MatSmithLondon
@MatSmithLondon 11 месяцев назад
@@csongorvarga Any idea what the command to do that might be? I have tried this: "sudo influx delete --bucket nodered --start 2013-03-01T00:00:00Z --stop 2023-08-24T00:00:00Z --predicate '_measurement="emporia_power" AND _field="empty_10_1min"' --org CHR". The command doesn't produce an error. But when I go into Influx data explorer (web interface) and refresh the page, then click into the measurement, (also need to change aggregate function to "last" and set visualisation type to "table") that field still exists with loads of data. All the data values are "unknown" but there are a lot of them...
@csongorvarga
@csongorvarga 11 месяцев назад
@@MatSmithLondon I am going through my notes and I have this as an example: influx delete --bucket aggregates --start 2005-03-01T00:00:00Z --stop 2022-03-01T00:00:00Z --predicate '_measurement="example-measurement" AND exampleTag="exampleTagValue"' . And based on this, I used an example this: influx delete --bucket nodered --start 2005-03-01T00:00:00Z --stop 2023-03-01T00:00:00Z --predicate '_measurement="sensors" AND device="house"' . You need to put the filters after predicate into single quotes. If I can in your example your predicate ends with single quote+double quote, but I think it should be double quote+single quote to correctly close the parameter after predicate. But this has worked for me. And I would remove any aggregate function from the query so see each record in the database.
@gopalr5894
@gopalr5894 2 года назад
Dear Varga. How can we create measurement in influxdb 2.1 OSS for my Bucket? Because your video state that already created measurement like sensor mydb bucket.
@csongorvarga
@csongorvarga 2 года назад
You just start creating new data and the measurement gets created automatically. It is not like a table that you need to define manually.
@gopalr5894
@gopalr5894 2 года назад
​@@csongorvarga Thanks Varga. Still I am not sure about data creation. Where can I create data like field, tag, measurement in influxdb 2.1 UI for my bucket? As of now I can create bucket only. After create bucket what to do?
@csongorvarga
@csongorvarga 2 года назад
@@gopalr5894 Influx is a structure less database. You load the data and the measurements, tag and fields will get created. There is an import feature in the UI to load data in CSV or line protocol format, otherwise you just push data form an external application like Node-Red.
@gopalr5894
@gopalr5894 2 года назад
@@csongorvarga Thanks for your Clarification. I want to push the data from Node-Red to Influxdb using Docker Images. But it won't work at all. Could you tell me using docker (Node-Red to Influxdb 2.1 OSS) to push the data.
@csongorvarga
@csongorvarga 2 года назад
@@gopalr5894 I don't know. I never worked with docker. If Node-Red and Influx are in different dockers it may not work.
@unknown3158
@unknown3158 Год назад
I was looking forward to this video but the background music is too loud and annoying, had to stop two minutes in.
@samdonche4607
@samdonche4607 2 года назад
69th like :D Thanks for the info!
@manpt123
@manpt123 Год назад
So you did not show how to create a measurement!
@csongorvarga
@csongorvarga Год назад
You don't have to create it. Once you start injecting data, it will get generated. And if you misspell it, that would be a new measurement.
@manpt123
@manpt123 Год назад
@@csongorvarga sorry but it took sometime for me to understand how influxdb really works.
@kzm1934
@kzm1934 Год назад
Informative but the background music needs to go!
@csongorvarga
@csongorvarga Год назад
No more background music. You will not hear on my new videos.
@peterretep2091
@peterretep2091 Год назад
after year is useless, this explorer is totally different
Далее
Downsample data in InfluxDB 2.x
28:51
Просмотров 10 тыс.
I've been using Redis wrong this whole time...
20:53
Просмотров 344 тыс.
Influx vs Prometheus vs Timescale
20:33
Просмотров 33 тыс.
InfluxDB: Flux Basics
4:43
Просмотров 12 тыс.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Просмотров 185 тыс.
My new Proxmox Monitoring Tools: InfluxDB2 + Grafana
19:46
PromQL (Prometheus Query Language)
19:00
Просмотров 7 тыс.