Check Mk and Slack

Email is a pain and still I notice that many users would like to receive an email if there is an alert with a host or service. As slack is getting more and more popular it might be a good idea  to send the alerts to a Slack channel instead. This is quite easy to do.

Start by creating an incoming webhook integration in your slack and note down the URL.

slack1

Choose what channel to post to. Copy the url. And save.

slack2

Visit the page below and download the script. Read any documenatation there.

https://github.com/rmblake/check_mk-slack

 

When done open it up and modify it like below. Insert your own url and change channel and eventually botname.

slack_path = "/services/T2STVDFGQR3/B2YTRES5S/g5ew91AVSTSFSSRS4fJlcL"
channel = "#" + os.environ['NOTIFY_PARAMETER_1']
if not channel:
    channel = '#monitor'
bot_name = "CMKBot"

Copy the script to your server. In my case it is under /omd/sites/mysite/share/check_mk/notifications/

Do (in this folder)

“sudo chmod +x slack”

Open WATO and create a new user called slack.

Create a new rule like below. Choose what hostgroups and other parameters you may want. Save and commit.

slack3

Wait for something to happen. Or add members to your new slack monitoring channel.

slack4