I have a influx database which contains more than 300 measurements. Some of these have similar names. Is there a way i can search the names of the measurements with similar string in the names. Does influx have any syntax similar to sql where i can find similar table names using 'like' operator. Can i use something like
SHOW MEASUREMENTS LIKE =~ 'foobar'
thanks
SHOW MEASUREMENTS WITH MEASUREMENT =~ /.*foorbar.*/
SHOW MEASUREMENTS WITH MEASUREMENT =~ /regular expression/
Related
I query all measurements from Influx database like so:
http://localhost:8086/query?pretty=true&db=boatdata&q=SELECT value FROM /.*/ LIMIT 1
Works fine. However, instead of LIMIT 1 I need to get values for all the measurements where value from one measurement=x, so I’d expect something like
SELECT value FROM /.*/ WHERE measurement1.value=x but it doesn’t work. I hope it makes sense. Any idea how to make it work? Thanks.
...to explain it better: in the first query (http://localhost…) I listed in this post I get a 1 record for all the measurements. But I want to get 1 record for all the measurements where value from measurement1 (one of the measurements) equals X.
This is impossible using InfluxQL. All measurements you ask are different series of data - so they are not grouped together in one table.
Idea of InfluxDB is that measurements are separate "tables" which are indexed by time and tag keys. I suggest you change your database architecture by writing values into different value fields.
You should have your data in one measurement to make query like you want.
You can move all your data from other measurements to one measurement for example by:
select "value" as "value1" from "measurement1" into "measurement" group by *
For each "measurement1" moved into "measurement" which will collect many value fields.
Then you will be able to make a query:
select * from "measurement" where "value1"=5
The query above should give you all value fields moved into "measurement" with the same timestamp where field "value1"=5.
Tip: If you have value1,value2,value3 in your measurement then you can use regex like:
select /value/ from "measurement" where "value1"=5
To avoid receiving tag key values or field values which you do not want.
InfluxDB's SHOW SERIES query returns a list of all series-tag-value combinations existing in the database.
How can I get a list of just the series' "base names" (without tags)?
Series without tags is just a measurement.
SHOW MEASUREMENTS [ON <database_name>]
I am using influxdb in conjunction with grafana. As part of a grafana query, I'd like to select influx series' that are part of a set that I know already. If my series are named 'a', 'b', and 'c', I'd like a "show series"-like command that will return eg. 'a', 'b'. Is this possible with influx?
I am not sure if I understand your question correct but you can select multiple Series with:
select * from a, b;
if your questions is about how you can solve this in grafana, you can simply create a graph with two query's. One which selects a and one which selects b
I had the same issue. Found this commit to influxdb:
https://github.com/influxdata/influxdb/pull/4501
Since you mentioned Grafana, I assume you want the measurements in a graphite format? In that case this syntax with regex seems to work:
SHOW MEASUREMENTS WITH MEASUREMENT =~ /cpu.*/
Would show all series related to %cpu%
However a regex on the SHOW SERIES query does not work (influxDB 1.3.3) even though it was indicated here https://github.com/grafana/grafana/issues/613
I am trying to write an influxdb query such that a measurement looks like
dummydata value=1,2,3,4
and influxdb doesn't like this format. I'm guessing influxdb cannot do this, but I can't find any documentation that says it cannot, nor do I see a feasible workaround. I have to write 500 points per timestamp: it seems to me that 500 separate measurements per timestamp would get hairy quick.
So:
Can influxdb accept an array/list as a value
If not, is there a workaround
Or is influxdb just the wrong tool for this job?
Thanks in advance.
InfluxDB accepts strings, float64s, int64s, and booleans as field values.
it seems to me that 500 separate measurements per timestamp would get hairy quick.
That's where you are mistaken. InfluxDB 0.10+ is specifically designed to encourage multiple fields per point, where a field is a measured value. What you want to write is a point like this:
dummydata value=1,value2=2,value3=3,value4=4...
when I use influxdb as the datasource, In the graph metrics define, I find that if I add a column after the "and" label, (like: latency_scope, type), data response is correct but legend display undefine, and there is no date display on the dashboard.
raw query is like this, however, it does not work.
"select latency_scope, uri, sum(sum_count) from "latency" where $timeFilter group by time($interval), latency_scope, uri fill(0) order asc"
Can grafana make multiple group by?
thx
I just checked the code, and that's true it does not support multiple group by, but it is not difficult to modify the source code to support.