Kapacitor stats

Trying to use the internal stats published via builtin _kapacitor database, but not getting any output.

Attached is the tick script we’re using to try and output the stats to a file for the sake of understanding what the data looks like.

stream
|from().database(’_kapacitor’).retentionPolicy(‘default’)
|alert().info(lambda: 0 == 0).log(’/tmp/kap_stats.log’)

We’re instantiating it with the following commands

kapacitor define stats -dbrp _kapacitor.default -tick stats.tick -type stream
kapacitor enable stats

Also, here’s a snapshot of the task via kapacitor show stats

ID: stats
Error:
Template:
Type: stream
Status: enabled
Executing: true
Created: 03 Apr 17 22:21 UTC
Modified: 03 Apr 17 22:22 UTC
LastEnabled: 03 Apr 17 22:22 UTC
Databases Retention Policies: ["_kapacitor".“default”]
TICKscript:
stream
|from()
.database(’_kapacitor’)
.retentionPolicy(‘default’)
|alert()
.info(lambda: 0 == 0)
.log(’/tmp/kap_stats.log’)

DOT:
digraph stats {
graph [throughput=“0.00 points/s”];

stream0 [avg_exec_time_ns=“0s” ];
stream0 -> from1 [processed=“0”];

from1 [avg_exec_time_ns=“0s” ];
from1 -> alert2 [processed=“0”];

alert2 [alerts_triggered=“0” avg_exec_time_ns=“0s” crits_triggered=“0” infos_triggered=“0” oks_triggered=“0” warns_triggered=“0” ];
}

Any hints would be appreciated. Also, I verified that /etc/kapacitor/kapacitor.conf has the stats section enabled.

Also, this is using kapacitor 1.2.0

Turned out the problem was with the stats config in /etc/kapacitor/kapacitor.conf, I had the retention policy set to “automatic”, and when it was changed to “default” everything worked.

@sputnik13 Glad to hear you were able to resolve this issue. What version of InfluxDB are you using? The name of the DEFAULT retention policy changed in 0.13 from default to autogen. Is this an old installation that you have upgraded?

No this is not an old installation, I was following the example in the default kapacitor.conf file… I’ve submitted a PR to update the example Update kapacitor.conf by sputnik13 · Pull Request #1298 · influxdata/kapacitor · GitHub

1 Like

@sputnik13 Thank you for that PR!