How to convert influxdb query to Kapacitor TICK script?

kapacitor
influxql

#1

Hi,

how can i convert influxdb query to Kapacitor TICK script in a batch node.
In terminal when i queried the below command
SELECT min(usage_user) FROM "telegraf"."autogen"."cpu" WHERE cpu = 'cpu-total' AND time > now()-7d

name: cpu
time                min
----                ---
1548634875000000000 0.1752190237792004

But in TICK script

var weeklyMinimum = batch
    |query('''SELECT mean(usage_user) AS usage_user FROM "telegraf"."autogen"."cpu"  WHERE cpu = 'cpu-total' ''')
        .period(7d)
        .every(30s)
    |httpOut('step3')

{"series":[{"name":"cpu","columns":["time","usage_user"],"values":[["2019-01-25T21:31:10.036028537Z",4.105535864528607]]}]}

Which is completely different from the influxdb query ?

Thanks


#2

Hi @BhanuKiran

One query is using min and one is using mean


#3

HI Sorry,
I just checked this mistake.


#4

No problem, happy to be the rubber duck!