Slack integration script for Bright Cluster Manager
Slack integration with Bright Cluster Manager monitoring is available via a built-in action script.
This script can be found under /cm/local/apps/cmd/scripts/actions/post_to_slack_web_hook.py.
The script requires a slack webhook to be configured (the configuration process is explained later in the article) in order to send messages to slack.
The supported authentication methods are:
- Passing the webhook url to the script as an argument in the monitoring configuration of Brightview or cmsh.
- Create a /root/.slackrc file and adding APP_SLACK_WEBHOOK=https://the-slack-url
Configuring the Slack webhook
In Slack, find the "Manage Apps" option in the main slack menu. Open the "Custom Integrations" Menu.
Click add configuration.
Configure the webhook settings as per the example below. Once complete, click save.
Now copy the webhook URL.
Configuring a Slack action in Brightview
In Brightview, navigate to the monitoring pane, select "Actions" and create a new script action as per the screenshot below. Paste in your Slack webhook URL as a parameter. Click save once complete.
Finally, you will need to apply the action to a trigger.
Navigate to the monitoring pane, select "Triggers". Clone the existing "Failing health checks" trigger, call it "Slack Failing health checks". Complete, the configuration below by adding the "Send message to slack" as an enter action for the trigger. Once complete, click save.
Now, once a health check returns a fail, a message will be posted in slack.