Search code examples
pythondatabasebashinfluxdbkapacitor

creating a data generator/recycler for influxdb


i want to create some sort of a data generator for a lab environment.

i thought of creating some kind of a script, that will get db name and comma separated metric names, and will fetch old data from the influx-db, change its time stamp to the current time, and save it back to influx-db.

i'm not sure what would be the best and easiest way to do it, python script? kapacitor udf ? any ideas ?

i'm new to the tick environment so i can really use some ideas :)

thanks, David,


Solution

  • found the perfect way, quick and easy, using kapacitor, not even need to create a udf...

    create this tick script and define it as a kapacitor task:

    var data = batch
        |query(''' SELECT * FROM "My_DB"."My_RP"."My_Measurement" ''')
            .period(1d)
            .every(30s)
            .offset(10d)
    data
        |shift(10d)
        |influxDBOut()
            .create()
            .database('My_DB')
            .measurement('My_Measurement')
    

    works like magic !