Hello @debnath,
I’m a little confused by your task.
It doesn’t look like you’re doing anything with the data in the following lines:
initialData
|> filter(fn: (r) =>
(r["_measurement"] == "1071448494555_P"))
...
|> findColumn(fn: (key) =>
(true), column: "assetId")
I think you need to define the endpoint like this:
I would also consider using the http.post() function instead. http.post() function | Flux 0.x Documentation
And not using the monitor.notify() function unless you need that metadata.
Here’s an example of what I mean:
Query/Alert for Difference in Value - #2 by Anaisdg
As an aside here’s an example of using reduce() function to create a json so that a user can send it in a an http.post() function.
import "json"
import "http"
import "array"
lastReported = from(bucket: "engineering's Bucket") |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "CBBandwidthAlert")
|> filter(fn: (r) => r["_field"] == "code")
|> group()
|> map(fn: (r) => ({ r with index: 1 }))
|> cumulativeSum(columns: ["index"])
|> map(fn: (r) => ({ r with gindex: r.index / 250 }))
|> group(columns: ["gindex"])
|> reduce(
fn: (r, accumulator) => ({ _value:accumulator._value + "\"" + r.host + "\","}),
identity: {_value: "{hosts:["}
)
|> map(fn: (r) => ({ r with _value: r._value + "]}" }))
|> yield()
Does any of this help? If not please let me know. Also bravo for getting this far with Flux.