It is a simple PHP script that uses the custom alert script functionality within Zabbix along with the Slack Web Api
- PHP greater than 5.4.
- Default zabbix notification messages.
- Message threading by event ID.
- Icons by event priority.
- Add reaction icon for resolved alerts.
- Download project
- Make symbolic link to
bin/sendSlackAlert.phpto yourAlertScriptsPathdirectory (that is specified within the Zabbix servers' configuration filezabbix_server.conf).
- Copy
config/config.inc-sampletoconfig/config.incfile. - Create a new bot: https://[your team].slack.com/apps/new/A0F7YS25R-bots
- Invite bot for private channels.
- Place "OAuth Access Token" to
SLACK_ACCESS_TOKENconstant. - Fill
SLACK_USER_NAMEconstant. - Fill
ZABBIX_FRONTEND_URLconstant.
- Add new media type: Administration -> Create media type:
- Name:
Slack - Type:
Script - ScriptName:
sendSlackAlert.php(our symlink) - Script parameters:
{ALERT.SENDTO}{ALERT.SUBJECT}{ALERT.MESSAGE}
- Enabled:
true
- Name:
- Add media to user (Media tab):
- Type:
Slack - Send to: , e.x.
#zabbix - When active:
1-7,00:00-24:00 - All other flag are default
- Enabled:
true
- Type:
- Add new action: Configuration -> Actions
- Action tab by default
- Conditions tab by default
- Operations tab -> Action operations -> new:
- Send only to:
Slack - Add user to
Send to Usersblock - Push
addlink
- Send only to:
- Push
addaction button.
- Enjoy it!
If you have any questions, please write to [email protected]