A custom media type for Zabbix that will deliver PROBLEM / RESOLVED alerts to Slack.
- Graph links and acknowledge buttons are probably broken
Acknowledgements:
-
Clone this repo into your Zabbix servers "AlertScriptsPath"
-
Run
npm install
inside the cloned repo -
Log into Zabbix, go to Administration -> Media Types -> Create media type
-
Set the following values:
Key Value Type Script Script name zabbix-slack-node/slack.sh
Script parameters {ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE} https://your.zabbix.website.example Your slack webhook URL -
Create a new user with sufficient permissions to view problems for all hosts
-
Add a media to the user, with
Type
=>Slack
andSend to
=>#your-slack-channel
-
Go to Configuration -> Actions -> Create action and ensure that the operation is defined like so:
Key | Value |
Default subject | {HOST.NAME1} {TRIGGER.STATUS}: {EVENT.NAME} |
Default message |
Host: {HOST.NAME1} Event: {ITEM.KEY1} Item ID: {ITEM.ID} Event ID: {EVENT.ID} Trigger ID: {TRIGGER.ID} Severity: {TRIGGER.SEVERITY} Status: {TRIGGER.STATUS} Trigger: {EVENT.NAME} Ack: {EVENT.ACK.STATUS} Service: {TRIGGER.HOSTGROUP.NAME} Value: {ITEM.VALUE1} Text: {TRIGGER.STATUS}: {EVENT.NAME} Tags: {EVENT.TAGS} IP: {HOST.IP1} Template: {TRIGGER.TEMPLATE.NAME}: {TRIGGER.EXPRESSION} When: {EVENT.DATE} {EVENT.TIME} |
Operations |
|
Key | Value |
Default subject | {TRIGGER.STATUS}: {EVENT.NAME} |
Default message |
Host: {HOST.NAME1} Event: {ITEM.KEY1} Item ID: {ITEM.ID} Event ID: {EVENT.ID} Severity: {TRIGGER.SEVERITY} Status: {TRIGGER.STATUS} Trigger: {EVENT.NAME} Trigger ID: {TRIGGER.ID} Ack: {EVENT.ACK.STATUS} Service: {TRIGGER.HOSTGROUP.NAME} Value: {ITEM.VALUE1} Text: {TRIGGER.STATUS}: {EVENT.NAME} Tags: {EVENT.TAGS} IP: {HOST.IP1} Template: {TRIGGER.TEMPLATE.NAME}: {TRIGGER.EXPRESSION} When: {EVENT.DATE} {EVENT.TIME} Recovered: {EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME} |
Operations | Notify all involved |
Key | Value |
Default subject | {USER.FULLNAME} acknowledged: {EVENT.NAME} |
Default message |
message: {ACK.MESSAGE} acknowledgement: yes status: {EVENT.STATUS} Severity: {TRIGGER.SEVERITY} |
Operations | Send message to users: Slack (Slack) via Slack |