Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get debug information when developing tick script for kapacitor?

Tags:

kapacitor

I am wondering if during tickscript development, there is any opportunity to dump the stream state after passing through the processing node (log to the file, stdout)?

like image 938
Grzegorz Szadkowski Avatar asked Oct 27 '16 15:10

Grzegorz Szadkowski


3 Answers

I am able to dump data from within a tick script into a separate database...

stream
    |from()
        .database('telegraf')
        .measurement('cpu')
        .groupBy(*)
        .where(lambda: "cpu" == 'cpu-total')
    |eval( lambda: 100.0 - "usage_idle" )
        .as('usage_util')
        .keep()
        .quiet()
    |InfluxDBOut()
        .create()
        .database('debugging')

Then I use Chronograf explorer to view the results...

like image 116
ericslaw Avatar answered Sep 28 '22 03:09

ericslaw


I found it useful putting |httpOut('id') for debugging purposes. Later you can access http://kapacitor-host:9092/kapacitor/v1/tasks/<task_id>/<httpOut_id> and see what data is passing through that node.

like image 6
tmszdmsk Avatar answered Oct 19 '22 23:10

tmszdmsk


Kapacitor has a Log Node that allows you to dump the stream state to the Kapacitor log files.

In use, it would look something like the following:

stream.from()...
  |window()
      .period(10s)
      .every(10s)
  |log()
  |count('value')
like image 3
Michael Desa Avatar answered Oct 19 '22 21:10

Michael Desa