Need help with Kapacitor tick script to calculate success rate


I need to enter into influxDB a new measurement. I use this query to get the values every 5min. So every 5 min I have the success rate by dividing the derivatives of two values.
How can I do this in Kapacitor? The goal is to have a measurement with the KPI values so that I can then use chronograf to alarm if SR drops below a threshold.

select 100*(derivative((“TotalAccepted”),5m))/(derivative((“TotalCPCReq”),5m)) from gtpcstatistics where host=‘CHPCF001’ and apn=‘avl’ and time>now()-10m
name: gtpcstatistics
time derivative_derivative

1518729973266475000 80.66037735849056



I will try to write a tick with 2 batch: first with the TotalAccepted and the second with the TotalCPCReq.

After that, you will need to join both (example of join and batch: make the division on the join and establish the threshold…

I guess this should work!