Posting URL alerts to a Slack channel

Post URL alerts to one or more Slack channels.

Post URL alerts to one or more Slack channels.

Multiple instances of the config_location/slack_posturl.conf file results in multiple instances of the event plugin. The Slack configuration file can have any name provided the file has the .conf file extension, contains the valid event plugin identifier [posturl], and resides in the event-plugins directory location. All configuration files are loaded, so differentiate the file names such as slack_posturl1.conf, slack_posturl2.conf, and so on. Multiple plugin instances facilitate flexibility when setting up alerts to different Slack channels for development and production clusters. All OpsCenter event plugins support multiple configurations files and subsequent plugin instances.

Tip: OpsCenter can post alerts via http or https. To enable https, update the URL from http:// to https://.


Set up an incoming webhook integration using Slack. For instructions, refer to the Slack API.


  1. Create a new file slack_posturl.conf in the conf/event-plugins/ directory.
  2. Copy and paste the contents from the following example into the file.

    Example slack_posturl.conf:

    # levels can be comma-delimited list of any of the following:
    # If left empty, will listen for all levels
    # clusters is a comma-delimited list of cluster names for which
    # this alert config will be eligible to run.
    # If left empty, this alert will be called for events on all clusters
    # the URL to send an HTTP POST to
    # Set a username for basic HTTP authorization
    # Set a password for basic HTTP authorization
    # The number of seconds before a connection to url or proxy_url
    # will be aborted due to a timeout
    # Set the type of posted data. Available options are 'json' or 'form'
    # Fields specified here will override the default event data fields.
    # They must be formatted as key-value pair, with key and value separated by
    # an equals (=). Each pair after the first must be on its own line,
    # indented beyond the first line
    # You may use tokens found within the default event data for or in
    # values. For example, some available keys are:
    #   cluster, time, level_str, message, target_node, event_source, success, api_source_ip, user, source_node
    # Keys must be encapsulated in {brackets}.
    #    mixedKey=cluster-{cluster}
    #    event-msg={message}
    fields=text={level_str} from {cluster}: {message}
    # Customizable templates for http post data. Some available keys are:
    #     node, cluster, datetime, level_str, message, target_node, event_source, success, api_source_ip, user, source_node
    # More advanced formatting options explained here: Each line
    # beyond the first must be indented. Use with post_type=template, and content-type and other headers must be manually
    # assigned.
    #  "messages":[
    #    {{
    #      "type": "link",
    #      "message": "Cluster {cluster} failure - {message}"
    #      "href": "http://opscenter1"
    #    }}
    #  ]}}
  3. Required: Ensure that the URL in the example config file url= is replaced with your custom-defined incoming webhook URL.
  4. Save slack_posturl.conf and restart the OpsCenter daemon.
    Verify alerts are getting populated in the Slack channel that you defined for your webhook.