Questions tagged [influxql]

Use this tag for questions related to InfluxQL, an SQL-like query language for interacting with data in InfluxDB.

219 questions
1
vote
1 answer

InfluxDB calculate for how long was a signal switched on

I have some measurements with boolean type values and want to calculate for how long was the signal in true state during a certain period of time. For example: datetime state 01.01.2021 01:00 true 01.01.2021 04:00 true 01.01.2021…
dskalec
  • 316
  • 2
  • 10
1
vote
0 answers

Need help converting InfluxQL query to InfluxDB2 Flux

I’m trying to figure out how to convert a rather simple influxql query to influxdb2 flux but I just can’t find the correct way. This is the query: SELECT NON_NEGATIVE_DERIVATIVE(MEAN(transmit), 10s) as transmit,…
Flexburo
  • 81
  • 4
1
vote
1 answer

InfluxDB - limit query result by number of series using Flux

I'm trying to query my InfluxDB (1.8) using Flux and retrieve only 100 series, at first I thought the "limit" function will do it, however, I found out it only limits the number of records in each table (series) which can result in max(100) *…
1
vote
2 answers

How to replace an empty InfluxDB query result with a single value for the single stat visualization

I'm using the new InfluxDB2 and the flux query language to retrieve docker stats from my bucket. I want to display the uptime of a container in a single stat widget. For this I use the following query: from(bucket: "docker") |> range(start:…
totkeks
  • 89
  • 2
  • 9
1
vote
0 answers

How does sample function work in InfluxDB

I tried to use sample() function in influxDB to get random dataset from it. I want to know more about the internal working of the sample() function present in InfluxDB, like does it scan the whole measurement(table) to get the random subsets from it…
1
vote
1 answer

InfluxDB 2.0 - How to convert double to dateTime:RFC3339

I'm trying https://github.com/percona/mongodb_exporter with InfluxDB scraper. I found out it's inserted as double. My goal is to get last data point and convert it to dateTime:RFC3339. ENV: influxdb:v2.0.1 mongodb_exporter:v0.20.1 mongodb_exporter…
RammusXu
  • 1,180
  • 1
  • 7
  • 21
1
vote
1 answer

Is it possible to execute a delete query on the default retention policy in influxdb?

Influx database named "metrics" with two retention policy and assign one as default out of the two. CREATE RETENTION POLICY basic ON "metrics" DURATION 2h REPLICATION 1 SHARD DURATION 6m DEFAULT CREATE RETENTION POLICY downsample ON "metrics"…
Rajan
  • 416
  • 1
  • 7
  • 25
1
vote
1 answer

Writing list of dictionaries to Influxdb

I have a list of dictionaries as follows: [{"vins": "50EA1LGA5KA900001", "use": "abc", "owner": "Jack"}, {"vins": "50EA1LGA0KA900004", "use": "xyz", "owner": "Laura"}, {"vins": "50EA1LGA2KA900005", "use": "pqr", "owner": "Sam"}] I want to write the…
Shrads
  • 883
  • 19
  • 39
1
vote
1 answer

Calculation average request time using InfluxDB on Grafana

I am using influx to save metrics. I am trying to create a dashboard in grafana that will show the average execution time of a method per hour. This is my query for calculating execution time of a method: raw sql: The query to calculate the…
NeverSleeps
  • 1,439
  • 1
  • 11
  • 39
1
vote
1 answer

How to space out influxdb continuous query execution?

I have many influxdb continuous queries(CQ) used to downsample data over a period of time on several occasions. At one point, the load became high and influxdb went to out of memory at the time of executing continuous queries. Say I have 10 CQ and…
Rajan
  • 416
  • 1
  • 7
  • 25
1
vote
0 answers

How to show top 10 most frequent tags in Grafana, using InfluxDB as data source

I am trying to show top 10 most frequent tags in Grafana, but I can't make it. The schema of my measurement (which is called mymeasurement) in InfluxDB is as follows: timestamp | value | mytag ------------------------- time_1 | 1 |…
Herricane
  • 11
  • 2
1
vote
0 answers

InfluxDB Continuous Query without GROUP BY time

I want to count the number of events during last 1 week from a measurement X and store the count into another measurement Y periodically using an InfluxDB CONTINUOUS QUERY. However it seems "GROUP BY time" is mandatory in the query. This results in…
codeseeker
  • 85
  • 2
  • 5
1
vote
0 answers

InfluxDB query except last

Is there a way to create a InfluxQL query which selects all values except the last? My current InfluxDB query in Grafana looks like this: SELECT sum("Counter_Volume") AS "Volume per hour" FROM "DataBeforeReset" WHERE $timeFilter GROUP BY time(1h)
Nisl
  • 136
  • 1
  • 4
1
vote
1 answer

How do you get age of last measurement in grafana/influxql?

A watchdog process reports host "liveness" by writing a measurement in influxdb, e.g. watchdog,host=host_xyz alive=1 I'm interested in showing in Grafana when too much time has passed since the last measurement. Is there a way to query such…
Erion
  • 113
  • 4
1
vote
0 answers

InfluxDB returns no results when adding logical OR condition

I am trying to use the following InfluxDB query with conditions on both time and field value, but it returns no results: > select * from something where (time > 1 and time < 20000) or (def > 999) However when I remove the last condition, my…