influxdata / influxdata/kapacitor
Could not create alert on non telegraf database
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I created a database named example using influxdb-python
In my database, I have a field key as value.
This is how my database looks like
> use example
Using database example
> show measurements
name: measurements
------------------
name
packet
> select * from packet
name: packet
------------
time value
1257894000000000000 0.59
1257894010000000000 0.5
1257894020000000000 0.4
1257894030000000000 0.6
1257894040000000000 0.64
1257894050000000000 0.88
1257894055000000000 0.91
1257894056000000000 0.33
1257894057000000000 0.2
1257894058000000000 0.51
1257894059000000000 0.59
Now, I want to keep a log of records whose value is greater than 0.5.
Given below is my TICKScipt
```
// Select just the cpu measurement from our example database.
|from()
.database('example')
.measurement('packet')
|alert()
.crit(lambda: "value" > 0.5)
// Whenever we get an alert write it to a file.
.log('/tmp/alerts.log')
```
This does not process any records.
I run these commands for executing the alert script:
kapacitor define try_alert -type stream -tick try_alert.tick -dbrp example.autogen
kapacitor enable try_alert
kapacitor show try_alert
ID: try_alert
Error:
Template:
Type: stream
Status: enabled
Executing: true
Created: 13 Nov 16 12:34 IST
Modified: 13 Nov 16 14:36 IST
LastEnabled: 13 Nov 16 14:36 IST
Databases Retention Policies: ["example"."autogen"]
TICKscript:
stream
// Select just the cpu measurement from our example database.
|from()
.database('example')
.measurement('packet')
|alert()
.crit(lambda: "value" > 0.5)
// Whenever we get an alert write it to a file.
.log('/tmp/alerts.log')
DOT:
digraph try_alert {
graph [throughput="0.00 points/s"];
stream0 [avg_exec_time_ns="0" ];
stream0 -> from1 [processed="0"];
from1 [avg_exec_time_ns="0" ];
from1 -> alert2 [processed="0"];
alert2 [alerts_triggered="0" avg_exec_time_ns="0" crits_triggered="0" infos_triggered="0" oks_triggered="0" warns_triggered="0" ];
}
alerts.log does not get generated at specified path.
Contributor guide
Research direction
Start with the try_alert.tick TICKscript and the kapacitor define/enable commands, then reproduce the stream against the example.autogen retention policy. Check why the packet records are not processed and why /tmp/alerts.log is not created; done means records meeting the value threshold are handled and alerts are logged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100