influxdata / influxdata/kapacitor
kapacitor is alerting to slack
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi Team,
I have below installed to my Mac OS:
InfluxDB v1.2.3, Telegraf v1.2.1 and Kapacitor.
After running Influx DB, starting telegraf and starting kapacitor, I can see the alerts being logged to the log file present in my Mac but I can't see the alerts being sent to Slack channel.
Below is output of the: kapacitor show cpu_alert2
```
ID: cpu_alert2
Error:
Template:
Type: stream
Status: enabled
Executing: true
Created: 16 May 17 16:38 CDT
Modified: 17 May 17 12:09 CDT
LastEnabled: 17 May 17 12:09 CDT
Databases Retention Policies: ["kapacitor_example"."autogen"]
TICKscript:
stream
// Select just the cpu measurement from our example database.
|from()
.measurement('cpu')
|alert()
.crit(lambda: sigma("usage_idle") > 3)
// Whenever we get an alert write it to a file.
.log('/Users/ravikumarsingh/Desktop/alerts.log')
.slack()
DOT:
digraph cpu_alert2 {
graph [throughput="0.00 points/s"];
stream0 [avg_exec_time_ns="0s" ];
stream0 -> from1 [processed="962"];
from1 [avg_exec_time_ns="619ns" ];
from1 -> alert2 [processed="962"];
alert2 [alerts_triggered="21" avg_exec_time_ns="72.024µs" crits_triggered="12" infos_triggered="0" oks_triggered="9" warns_triggered="0" ];
}
```
So, I can see 21 alerts being triggered and I can see the alerts to the log file also but its not being sent to the slack channel.
Below is the slack configuration in kapacitor.conf file:
```
[slack]
enabled = true
url = "https://hooks.slack.com/services/********/********/******"
channel = "#general"
username = "kapacitor"
icon-emoji = ""
global = true
state-changes-only = false
Below is telegrapf.conf file:
[agent]
interval = "1s"
[outputs]
# Configuration to send data to InfluxDB.
[outputs.influxdb]
urls = ["http://localhost:8086"]
database = "kapacitor_example"
user_agent = "telegraf"
# Collect metrics about cpu usage
[cpu]
percpu = false
totalcpu = true
drop = ["cpu_time"]
~
```
I am not sure if there is some issue with my Databases Retention Policies. Requesting you to please let me know what I am doing wrong here.
Contributor guide
Research direction
Start with the Slack section in kapacitor.conf and the cpu_alert2 TICKscript shown in the issue, then run kapacitor show cpu_alert2 and compare its alert activity with alerts.log. Determine why the configured Slack notification is not delivered; done means triggered alerts appear in the configured Slack channel.
Written by the indexing model from the issue text.
Assessment
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100