ericsysmin's DevOps Blog

Integrating Zabbix w/Slack for Channel Notifications

I’ve been using Slack and Zabbix now for a few years, and figured since there’s not too many guides out there on how to integrate the two easily. I know there are a few examples so far, but this is what’s worked best for me.

First I use this script, and put it in your alertscripts directory, ex.   /usr/lib/zabbix/alertscripts .

Notice there’s no field for credentials. That’s because over time I found it easier to deploy with a configuration file that was in yaml format.

Make sure you create an API token for slack by creating a Slack App, then using it’s Verification Token. Hopefully in the future I revisit this and make use of the Client ID, Client Secret, Signing Secret configuration.

So to provide that file we need to create the following in your zabbix configuration directory ex.  /ext/zabbix/slack.yml .

This makes it easier at least for me to deploy and separate configuration from the script itself.

Next steps include creating the Slack Media Type.

Navigate to Administration > Media types

Select “Create media type”, and fill out the following:

 

Don’t forget to save!

Your first value is going to be “Channel” the rest fill in the message details.

Continue reading...