kapacitor: setting slack webhook URL in .tick file

467 views Asked by At

I am using a TICK stack deployed in Docker containers. I would like to set up kapacitor alerts to send different notifications based on alert levels (ie. crit, warn, inform). As far as I can see, the only way to do this is by using different alert nodes, one for each alert type. I am using SLACK as one of my alert types but would like to send to different slack web hooks, again, based on the alert level. Configuring the kapacitor.conf file as such:

[slack]
  # Configure Slack.
  enabled = true
  # The Slack webhook URL, can be obtained by adding     
  # an Incoming Webhook integration.
  # Visit https://slack.com/services/new/incoming-webhook
  # to add new webhook for Kapacitor.
  url="https://hooks.slack.com/services/....."

Makes is so that all alert notes that send to slack, send the alert to that webhook. Is there a way to configure the alert node to send to a specific webhook dynamically from within the .tick file. For example:

stream
  |from()
    .measurement('cpu')
  |alert()
    .slack()
    .warn(lambda: "usage_user" > 50)           
      .url("https://hooks.slack.com/services/some_url")
    .crit(lambda: "usage_user" > 70) 
      .url("https://hooks.slack.com/services/another_url")

I see that other alert types allow for configuration from the .tick file but I have not been able to find much in the Slack alert. Thanks.

0

There are 0 answers