Questions tagged [flux-influxdb]

Flux is designed to be usable, readable, flexible, composable, testable, contributable, and shareable. Its syntax is largely inspired by 2018’s most popular scripting language, Javascript, and takes a functional approach to data exploration and processing.

The following example illustrates querying data stored from the last hour, filtering by the cpu measurement and the cpu=cpu-total tag, windowing the data in 1 minute intervals, and calculating the average of each window:

from(bucket:"example-bucket")
  |> range(start:-1h)
  |> filter(fn:(r) =>
    r._measurement == "cpu" and
    r.cpu == "cpu-total"
  )
  |> aggregateWindow(every: 1m, fn: mean)
130 questions
14
votes
6 answers

Grafana - InfluxDB 2 - Label/Alias data

I am in the processing of migrating my panels from using the SQL syntax (from InfluxDB version 1.X) to the new influx syntax (InfluxDB version 2). There is an issue with the labels of the data. It includes the attributes that I used to filter it.…
TheNiceGuy
  • 3,462
  • 8
  • 34
  • 64
6
votes
1 answer

Why is this InfluxDB Flux query returning 2 tables?

Obv. I'm new to InfluxDB & the Flux query language so appreciate patience! Happy to be redirected to documentation but I haven't found anything genuinely useful to date. I've configured Jenkins (2.277.3) to push build metrics to InfluxDB (Version…
CPH
  • 501
  • 1
  • 5
  • 14
5
votes
2 answers

Get the number of points in a bucket for a time interval with Flux query

Given a bucket how do I get the number of points in this bucket with the timestamp in the given time interval using a Flux query? I'm trying to estimate how much data is added to an influxdb2 bucket per unit of time.
axk
  • 5,316
  • 12
  • 58
  • 96
5
votes
2 answers

Influxdb 2.0 Flux - How to return 0 instead null

I want to count amount of values that are greater than specific value. Data: from(bucket: "bucket name") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r._value > 35) |> count() If there are no values in…
Amerousful
  • 2,292
  • 1
  • 12
  • 26
4
votes
1 answer

flux query very slow in compare to InfluxQL (10x slower)

I'm upgrading form influx1.x to influx2.x (updating queries from influxQL to Flux syntax). For very simple queries, performance drops dramatically when I try to query more than 500,000 points and I'm not sure if there's anything I can do to improve…
4
votes
1 answer

Finding the Sum based on Group using Flux Query - InfluxDB

I am trying to use flux query language to find the sum of a column based on a person. If I have the following input table: How can I use a Flux Query to obtain the following output table: I have tried something like this so far but I get…
Dr.Dough
  • 145
  • 1
  • 6
4
votes
1 answer

Grouping by increasing stateDuration resets using Flux in InfluxDb

I am recording period between application heartbeats into Influxdb. The "target" period is 2000ms. If the period is above 2750ms, then it is defined as a "lag event". My end objective is to run statistics on "how long" we are running without lag…
takilara
  • 108
  • 6
4
votes
1 answer

Thin out influx database time series / remove duplicates

I made a mistake while logging data to my influx database. Instead of logging every change of my sensors as a measurement point into the table, i accidently forced logging data every second. So, the most of them are basically the same and obviously…
harrow
  • 178
  • 1
  • 11
3
votes
0 answers

How to change admin password on Influx2?

I have an influxdb2 database running in kubernetes. I can login to the web interface as admin I can also access the pod running influx2 and run the influx command. I cannot for the life of me figure out how to change the admin password. There…
CareFree
  • 301
  • 1
  • 11
3
votes
1 answer

How do I return timestamp instead of time from influxdb?

I query data from InfluxDB 2 using Flux query like: from(bucket: "first") |> range(start: time(v: 0)) |> filter(fn: (r) => r["_measurement"] == "test" and r._field == "volume") |> keep(columns: ["_time", "_value"]) |> last() This gives me a…
Anton Ivanov
  • 199
  • 1
  • 11
2
votes
0 answers

aggregateWindow works different than expected for the current day

I accumulate data from my inverter on the daily PV production. I wanted to create a query to summarize production for each of the last 12 months. I have a problem with the current day: seems that it does not add the current day production to the…
2
votes
2 answers

InfluxDB2 / Grafana : how can we filter a list of tag values with flux

InfluxDB2 flux language provides a convenient way to get all the tags values for a specific bucket/measurement combination, using the schema.measurementTagValues function. The problem is that the documentation doesn't mention how to filter this list…
Fabien
  • 346
  • 2
  • 10
2
votes
0 answers

Fetch row based on group and having in influxDB

I'm new at influxDB and trying to solve a query. Where I need to fetch rows based on group by field3 columns and having should count less than 300. I've written it in SQL but not able to fetch any data from influxDB. select count(field1),…
Md Enayat
  • 147
  • 1
  • 12
2
votes
1 answer

InfluxDB 2.0 - Flux query: How to sum a column and use the sum for further calculations

I am new to flux query language (with Influx DB 2) and cant find a solution for the following problem: I have data with changing true and false values: I was able to calculate the time in seconds until the next change by using the events.duration…
JCoordes
  • 147
  • 4
  • 10
2
votes
2 answers

influx aggregateWindow with continuous counter

An influx 2 database stores incrementing values from an mechanical counter (gas counter). The goal is to build a query to get the consumption over a certain interval, e.g. one day. With SQL I would group the data in the desired interval and than…
AndiR
  • 179
  • 10
1
2 3
8 9