[Solved]Kapacitor - editing a metric value

kapacitor
influxdb

#1

hi,
in a simple tick script, how can i query points and edit some key/values ?

i have this tick script, that queries some data, i want to change the CPU field on each point and add 5 to its value.

var data = batch
    |query(''' SELECT * FROM "telegraf"."autogen"."cpu" ''')
        .period(5m)
        .every(10s)
        .groupBy(*)
    |influxDBOut()
        .database('telegraf)
        .retentionPolicy('autogen')
        .measurement('modified_data)

how can i do that ?
thanks.
Dave.


#2

found it :slight_smile:

data
    |eval(lambda: "cpu" + 5.0)
        .as('cpu_mod')
        .keep('cpu','cpu_mod')
    |influxDBOut()
        .create()
.
.
.