influxdata / influxdata/kapacitor

Execute Kapacitor using Tick Script

Open
#2,243 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Hi,
I am creating a sample Tick Script to generate alert based on threshold reached for cpu usage.
I am executing below commands:
kapacitor define cpu_alert -type stream -tick /root/cpu_alert.tick -dbrp telegraf.autogen
kapacitor enable cpu_alert

After executing above commands I am expecting that an error file gets generated. But, unfortunately the file is not generated.
I am using Armbian OS. I installed influx, telegraf & kapacitor packages from its default repository.
My Influxdb version is 1.7.7
Telegraf - 1.11.5

Using Chronograf I am able to create rule and generate alerts. Same thing I want to acheive using Tickscript created manually as my requirement is to use kapacitor without using Chronograf. So Chronograf is not in my solutions.

To generate alerts, I execute:
**dd if=/dev/zero of=/dev/null**

Attached below are my tick script and kapacitor.conf

[kapacitor_conf.log](https://github.com/influxdata/kapacitor/files/3556014/kapacitor_conf.log)

**[TickScript]**
stream
|from()
.measurement('cpu_usage_idle')
.groupBy('host')
|window()
.period(5s)
.every(5s)
|mean('value')
|eval(lambda: 100.0 - "mean")
.as('used')
|alert()
.message('{{ .Level}}: {{ .Name }}/{{ index .Tags "host" }} has high cpu usage: {{ index .Fields "used" }}')
.warn(lambda: "used" > 5.0)
.crit(lambda: "used" > 10.0)
// Alert
.log('/tmp/cpu_alert_log.txt')

Contributor guide

Open the contributing guide

Research direction

Start by reviewing kapacitor_conf.log and the supplied Tick Script, then reproduce the kapacitor define and enable commands on the reported Armbian setup. Compare the manual rule with the working Chronograf-created rule and verify whether the expected /tmp/cpu_alert_log.txt output is produced when CPU usage is increased; done means the cause of the missing alert log is identified.

Written by the indexing model from the issue text.

Assessment

Domain
observability-sre, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.