influxdata / kapacitor

Open source framework for processing, monitoring, and alerting on time series data
MIT License
2.31k stars 492 forks source link

Slack workspace specification in handler doesn't work #2054

Open stanislav-zaprudskiy opened 6 years ago

stanislav-zaprudskiy commented 6 years ago

We have the following Slack configuration in our Kapacitor 1.5.1:

[[slack]]
  enabled = true
  default = true
  url = "$KAPACITOR_SLACK_0_URL"

And the following handler specs:

id: slack-monitoring_alerts_channel
topic: slack-monitoring_alerts_channel
kind: slack
options:
  workspace: '<workspace>.slack.com'
  channel: '#alerts'
  username: 'kapacitor'

And with that, when alert kicks off, the following error "workspace id not found" shows up:

ts=2018-09-11T06:43:59.947Z lvl=error msg="failed to send event" service=slack handler=slack-monitoring_alerts_channel topic=slack-monitoring_alerts_channel err="workspace id not found"

(also tried setting log level to "DEBUG" but this still didn't provide a clue)

However, when the same workspace is specified in kapacitor.conf, it successfully sends alert to the channel.

[[slack]]
  enabled = true
  default = true
  url = "$KAPACITOR_SLACK_0_URL"
  workspace = "<workspace>.slack.com"
id: slack-monitoring_alerts_channel
topic: slack-monitoring_alerts_channel
kind: slack
options:
  channel: '#alerts'
  username: 'kapacitor'
connoranderson commented 5 years ago

I believe this is the desired functionality. Workspace is generally used for non-default configurations. In your first example, you are trying to specify the workspace when you have a global and default option available. In this case, you can just specify a channel and the handler should work.

In the second example, you are using the workspace option, but it is a little redundant since "default" is true. Generally you would use this when you have 2 or more distribution channels.