Skip to content

Alertscript for zabbix to enable discord notifications

License

Notifications You must be signed in to change notification settings

atomy/zabbix-discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This is an alert-script for notifications to Discord, issued from Zabbix. It uses Discord-webhooks.

Image of Discord-Notifcation

Prerequisites

Installation

  1. set env WEBHOOK_URL to your previously setup discord-web-hook-url in discord.sh (e.g. https://discordapp.com/api/webhooks/xxx/yyy)
  2. (optional) set env ZABBIX_URL in bash-script discord.sh to aim towards your zabbix installation (e.g. https://zabbix.your-domain-bleh.foo/), this will be used to link the discord-messages to your zabbix installation
  3. configure AlertScriptsPath of your zabbix installation - Zabbix Howto
  4. add the discord.sh script to your zabbix AlertScriptsPath directory
  5. make sure zabbix can access that file and it also has execution permission (chmod +x discord.sh)
  6. configure your custom alertscript in zabbix - Zabbix Howto, script parameters are (as shown in zabbix documentation):
    {ALERT.SENDTO}
    {ALERT.SUBJECT}
    {ALERT.MESSAGE}
    
  7. add media to a zabbix-user to be notified that way, the "Send to"-field is the discord-channel name here, e.g. #zabbix.
  8. (optional) probably re-configure zabbix-action for different message-format

Additional Info

I build a regexp into the script to detect if it's either a PROBLEM, OK or Resolved (never got things like {EVENT.VALUE} working)

Example webhook for discord

$ 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

Zabbix Media type config

Image of Discord-Notifcation

Zabbix User media config

Image of Discord-Notifcation

About

Alertscript for zabbix to enable discord notifications

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages