Regarding the first query when i put last stream at the end i receive the following error. “invalid: error @16:1-16:11: undefined identifier lastStream”
And if i completely remove laststream i don’t get an error but i’m not receiving the value i should be receiving as that dashboard visualization is stat so im simply expecting a number which i don’t seem to be receiving which at this time should be “9” as nine booking processes are down.
Regarding the one with the pivot, i double checked all the column names and some were slightly off by their casing which i fixed however im getting the below error:
invalid: compilation failed: error at @11:4-13:90: expected RPAREN, got EOF
so i removed the quotes from |> filter(fn: (r) => r.“AlarmStatus” == “1”) to |> filter(fn: (r) => r.AlarmStatus == “1”) and now it shows no eror but no data. However the funny thing is as soon as i remove |> filter(fn: (r) => r.“AlarmStatus” == “1”) the data will populate. So i think we can cancel out the column names as i do get data without that line.
When using dot notation to access a column in a row record, you can’t wrap the column name in quotes. You can either use dot notation:
|> filter(fn: (r) => r.AlarmStatus == "1")
or bracket notation:
|> filter(fn: (r) => r["AlarmStatus"] == "1")
I don’t know if this is a product of pasting code into the form on this forum, but it also appears you’re using typographer/curly quoates (“”). This will likely cause parsing errors. You should only use straight quotes ("").
The curly quotes are due to copy and pasting, i am using the correct quotes.
Any information regarding the first section?
Regarding the first query when i put last stream at the end i receive the following error. “invalid: error @16:1-16:11: undefined identifier lastStream”
And if i completely remove laststream i don’t get an error but i’m not receiving the value i should be receiving as that dashboard visualization is stat so im simply expecting a number which i don’t seem to be receiving which at this time should be “9” as nine booking processes are down.
Ok, this makes sense. You have to pivot the data before filtering by the AlarmStatus field. When loaded from InfluxDB, your data looks something like:
_time
_field
_value
2021-01-01T00:00:00Z
AlarmStatus
1
After the pivot, it will look like:
_time
AlarmStatus
2021-01-01T00:00:00Z
1
In the initial example, I was thinking AlarmStatus was a tag, not a field. You need to pivot the data before you’re able to filter by the AlarmStatus column. OR, if you don’t want to pivot the data, you can do:
Regarding the below query the issue i am having now, is that there are 358 processes currently running but the output of the below query only shows about 50 processes in the table. Same thing occurs with this flux query on the explore tab too. However with the old influxQL query all 358 processes show up in the output table.
InfluxQL Query:
SELECT last(“AlarmStatus”) as “AlarmStatus”, “CellName”, “CurrentProcessCount”, “ExpectedToRun”, “CheckStatus” FROM “eBond_ProcessMon” WHERE $timeFilter and AlarmStatus = 0 GROUP BY “ComponentName”, “host”
Hi Scott are you able to help with the conversion of the below influxql query to flux? It has a nested select statement within a select statement.
SELECT COUNT(LastVal) as foundRowsPast, COUNT(currentVal) as foundRowsNow FROM (SELECT last(InternalInfluxData) as LastVal FROM “ebond_AmpsConnections” GROUP BY ClientName),(SELECT last(InternalInfluxData) as currentVal FROM “ebond_AmpsConnections” WHERE time > NOW() - 5m GROUP BY ClientName) WHERE “ClientName”=~/AmpsRFQPriceEnricher/ OR “ClientName”=~/AmpsRFQFieldsEnricher/ OR “ClientName”=~/AmpsRFQPublisher/ OR “ClientName”=~/AmpsRFQStaticEnricher/ OR “ClientName”=~/AmpsRFQEnrichmentPublisher/ GROUP BY ClientName fill(0)
Hi Scott, apologies, are you able to help with the below conversion to flux?
SELECT * FROM “ebond_ProcsTakingLotsThreads” WHERE $timeFilter
AND “FullCommand” !~ /.activemq./
AND
(“FullCommand” !~ /.ebond-jtimeseries-server./ OR “NoOfThreads” >=1000)
AND
(“FullCommand” !~ /.ebond-swapcurvebuilder./ OR “NoOfThreads” >=3000)
AND
(“FullCommand” !~ /.ebond-amps-server./ OR “NoOfThreads” >=1000)
AND “NoOfThreads” > 3000
From the original influxQL query i reduced some of the NoOfThreads thresholds to produce some data in the dashboard which worked, however when i tried to make the reduction in the flux query you sent the same data is not showing up. The reason why i did this was to test the flux query is working correctly as we have had no data come into the dashboard for some time so wanted to reduce thresholds to populate the dashboard with some kind of data.
Reduced threshold influxQL query, showing data:
SELECT * FROM “ebond_ProcsTakingLotsThreads” WHERE $timeFilter
AND “FullCommand” !~ /.activemq./
AND
(“FullCommandName” !~ /.ebond-jtimeseries-server./ OR “NoOfThreads” >=1000)
AND
(“FullCommand” !~ /.ebond-swapcurvebuilder./ OR “NoOfThreads” >=3000)
AND
(“FullCommand” !~ /.ebond-amps-server./ OR “NoOfThreads” >=1000)
AND “NoOfThreads” > 1000
Equivalent reduction made in threshold for flux query but not showing the same data:
from(bucket: “ebondProcsTakingLotsThreads/one_week_only”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “ebond_ProcsTakingLotsThreads”)
|> filter(fn: (r) => r._field == r.FullCommand or r._field == r.NoOfThreads)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: “_value”)
|> filter(fn: (r) =>
r.FullCommand !~ /.activemq./ and
(r.FullCommand !~ /.ebond-jtimeseries-server./ or r.NoOfThreads >= 1000) and
(r.FullCommand !~ /.ebond-swapcurvebuilder./ or r.NoOfThreads >= 3000) and
(r.FullCommand !~ /.ebond-amps-server./ or r.NoOfThreads >= 1000) and
r.NoOfThreads > 1000
)