(God of English forgive me) Hello! I use Kapacitor for the first time. At the moment, the situation is as follows:
-Installed TICK Stack (Chronograf replaced by Grafana)
-There is a table in InfluxDB with the following data:
time | cache | url | name 10:20:30 123 0.0.0.50 name1 10:20:30 123 0.0.0.51 name1 10:20:35 123 0.0.0.01 name1 10:20:33 321 0.0.0.00 name1 10:20:31 200 0.0.0.50 name2
This is host replication data. Each host has 4 URLs and replication with 4 URLs (URL with 5 and URL with 0). A collection of hosts is called a node (name1 for example). It is necessary to output only hosts with different cache values.
-I tried stream and batch TICKScript, but without success.
Batch example:
var firstrep = stream .where(lambda: "url" =~ /\S+5\d/) .period(1h) .every(1m) .groupBy('name') .fill(0) var secondrep = batch |query('SELECT max("cache") FROM "tablename" WHERE "url" =~ /\S+0\d/') .period(1h) .every(1m) .groupBy('name') .fill(0) firstrep |join(secondrep).as('one','two') |eval(lambda: "first.max - two.max").as('delta') |InfluxDBOut().database('kapacitor').measurment('deltas')
But there is error in the regex, something about â/â, and I canât fix it long time.
Stream example:
var firstrep = stream |from() .database('telegraf') .measurement('tablename') .where("url" =~ /\S+5\d/) .groupBy('name') |window() .period(1h) .every(1m) |mean('cache') .as('cache') var secondrep = stream |from() .database('telegraf') .measurement('tablename') .where("url" =~ /\S+0\d/) .groupBy('name') |window() .period(1h) .every(1m) |mean('cache') .as('cache') firstrep |join(secondrep).as('firstrep','secondrep') .tolerance(10s) |eval(lambda: "firstrep.cache- secondrep.cache").as('delta') |InfluxDBOut().database('kapacitor').measurment('deltas')
For start and check the script I do:
kapacitor define deltatask -tick tickscript.tick -dbrp âtelegrafâ.âtablenameâ
After this:
kapacitor enable deltatask
The stream TICKScript compile fine, but there is no data in db, i tried to check httpOut() â {âseriesâ:null}. In DOT processed = 0 everywhere. Probably I need to edit kapacitor.conf, but I donât understand exactly how. I trying without âwhereâ condition - it seems like it doesnât see the data, maybe you know some steps to test it. Thank you!