/zabbix-slack

Zabbix to Slack notification script based on Bageljp's script with some small changes to fix issues with our zabbix base environment

Primary LanguageShell

About

All credits to Bageljp for the script. We had some strange issues regarding the sed command in our environment not working as intented so we switched it over. I am not a developer natively in this language so please step in with caution and read the code before using.

Please try the original script of Bageljp before attempting this.

Zabbix Server Action to Slack.com

Zabbix Server to Slack.com

Installation

Slack.com settings

Slack.com Incoming Webhooks

Script settings in Zabbix Server

cd /usr/lib/zabbix/alertscripts    # AlertScriptsPath
wget https://raw.githubusercontent.com/perplexityjeff/zabbix-slack/master/slack.sh
chmod a+x slack.sh
vi slack.sh
slack_url slack integration url. (ex. https://hooks.slack.com/services/XXX/XXXX/XXXXX)
slack_username slack post username.
emoji slack emoji.
zabbix_baseurl full URL of zabbix mainpage
zabbix_username zabbix username to grab the chart
zabbix_password zabbix password
chart_period how many seconds to be shown on the chart
chart_width width of the chart
chart_height height of the chart
chart_baseurl where the charts will be hosted
chart_basedir charts will be downloaded there

Zabbix Server Web Interface settings

  • Administration MediaType

Zabbix Server MediaType settings

  • Action settings default message

Zabbix Server Action settings

  • copy and paste.
HOST: {HOST.NAME}
TRIGGER_NAME: {TRIGGER.NAME}
TRIGGER_STATUS: {TRIGGER.STATUS}
TRIGGER_SEVERITY: {TRIGGER.SEVERITY}
DATETIME: {DATE} / {TIME}
ITEM_ID: {ITEM.ID1}
ITEM_NAME: {ITEM.NAME1}
ITEM_KEY: {ITEM.KEY1}
ITEM_VALUE: {ITEM.VALUE1}
EVENT_ID: {EVENT.ID}
TRIGGER_URL: {TRIGGER.URL}