This is a script for notifications to Discord issued from Zabbix. It uses webhooks.
- Discord Webhook Howto Setup Discord Webhook
- modify hard-coded zabbix urls in
discord.sh
to aim towards your zabbix installation ("url": "https://zabbix.your-domain-bleh.foo/"
) - modify hard-coded discord urls including token in
discord.sh
to aim towards your prior setup discord endpoint (https://discordapp.com/api/webhooks/xxx/yyy
) - configure
AlertScriptsPath
of your zabbix installation - Zabbix Howto - add the
discord.sh
script to your zabbixAlertScriptsPath
directory - make sure zabbix can access that file and it also has execution permission (
chmod 755 discord.sh
) - configure your custom alertscript in zabbix - Zabbix Howto,
script parameters are (as shown in zabbix documentation):
{ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE}
- add media to a zabbix-user to be notified that way, the "Send to"-field is the discord-channel name here, e.g. #zabbix.
- (optional) probably re-configure zabbix-action for different message-format
I build a regexp into the script to detect if it's either a PROBLEM or OK (never got things like {EVENT.VALUE} working)
$ curl -X POST --data '{ "embeds": [{"title": "<NOTIFICATION TITLE>", "url": "<NOTIFICATION URL>", "description": "<NOTIFICATION BODY>", "type": "link", "thumbnail": {"url": "https://storage.googleapis.com/material-design/publish/material_v_12/assets/0Bx4BSt6jniD7dFBUNHdrY05jQ3c/style-logos-product-intro-definition.png"}}] }' -H "Content-Type: application/json" https://discordapp.com/api/webhooks/xxx/yyyy