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

4

13

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)?

Hearten answered 27/10, 2016 at 15:3 Comment(3)
Can you explain what you're looking for a bit more. I'm not sure I totally follow what you're askingCoraliecoraline
There is a log node, but I prefer to write the data back to InfluxDb. We have a separate influx db just for this purpose with a 1 day retention policy so that data doesn't build up.Acidophil
You can pull Kapacitor stats via REST API and load them into InfluxDB. I wonder if InfluxData will release a Telegraf plugin for this - seems like a natural progression.Phosphoric
G
6

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.

Grangerize answered 16/3, 2017 at 10:27 Comment(0)
C
3

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')
Coraliecoraline answered 15/3, 2017 at 8:31 Comment(0)
I
2

Running kapacitor show TASK_NAME command should show you some information about the task itself but under the DOT: section there's a graph description which contains stats about how many data points reached which node.

Another way of debugging would be using InfluxDBOutNode to store the points and see what's being processed. Hope this helps.

Ileanaileane answered 14/3, 2017 at 10:3 Comment(0)
D
2

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...

Deceptive answered 14/9, 2017 at 19:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.