Hello,
I have set up this stream to get stats of the measurement each 5 min and write in other measurement. It should write the number of points received in the input measurement to a measurement called “stats”.
But it does’t work. It always writes 0 even there are new data. The kapacitor is installed in a linux server, and influxdb in other server. The link is ok, with subscriptions ok. any idea how to deep into the error?
var data_inv1 = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(input_measurement)
data_inv1
|stats(5m)
.align()
|derivative(‘emitted’) //this makes only add a point when changes
.unit(5m)
.nonNegative()
|influxDBOut()
.database(db)
.retentionPolicy(rp)
.measurement(‘stats’)
Thank you
I think that might be caused by the Derivate Node, if you have a fixed amount of points (by time unit) its result will always be 0.
Is this your case?
have you tried to store the data without the Derivate node? ( I expect the result will be a constant value, different form zero but constant)
Hello Giovanni,
But as far as I know the stats value gets the accumulated “emitted” points since the start of the kapacitor service. Then you need to get the derivative to check the new points in the interval, if greater than 0 it means you have new points.
Best regards
have you checked the stats node output?
You can check the data using the httpOutnode
var data_inv1 = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(input_measurement)
data_inv1
|stats(5m)
.align()
|httpOut('stats')
|derivative(‘emitted’) //this makes only add a point when changes
.unit(5m)
.nonNegative()
|httpOut('stats_derivate')
You can later query the outputted data from an http endpoint (see the docs).
This should show you which data are being gathered, before and after the derivate node.