Skip to content
perl script that passes notifications to mattermost using attachments and json
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Zabbix Matter Most Bot


zabbixMatterBot is a script that takes in json from zabbix, parses it, and outputs stuff to a channel.


i dunno, only tested with 3.4, but should work on anything newer as long as you can pass all the vars

Huge thanks and appreciation to:


The script itself

install the JSON perl module

cpanm JSON Data::Dumper

copy the perl script to your alert scripts directory

	[root@zabbix ~]# grep AlertScriptsPath /etc/zabbix/zabbix_server.conf
	### Option: AlertScriptsPath

	[root@zabbix ~]# ls -lh /var/lib/zabbix/
	-rwxr-xr-x 1 root root 1.6K Nov 19 20:04 /var/lib/zabbix/alertscripts/


mattermost web-hook

An incoming web-hook integration must be created within your Mattermost account which can be done at https:///chattr/integrations/incoming_webhooks:

the incoming web-hook URL would be something like:

https://<your mattermost uri>/hooks/ere5h9gfbbbk8gdxsdsduwuicsd

save it, you'll need it in a second.

Within the Zabbix web interface

When logged in to the Zabbix servers web interface with super-administrator privileges, navigate to the "Administration" tab, access the "Media Types" sub-tab, and click the "Create media type" button.

You need to create a media type as follows:

  • Name: Mattermost
  • Type: Script
  • Script name:

add the following script parameters (you can use my image, but all are required right now)
  • http://webhook.url.from.above/oranges
  • bots name here

create a user like zabbixBot, and set media then add choose the new script, and the channel you want it to go to like #alerts or @someone.

supported Types

so i wrote this to support triggers, but then i expanded it further.

in the examples folder you'll see a bunch of JSON, make sure you minify it

trigger.json - use for the trigger types in actions internal.json - for internal unsupported type triggers, and ldd

have not looked into the discovery or registration messages yet, its really just pulling all the macros and seeing what comes out. you can enable debugging and play with messages.

if you change notifyType from detailed to anything else then you'll get attachment style notifications for triggers. its bulkier but more information, still working on trying to exclude un-needed duplicate items.


try this as an examples

./ monitoring https://your.webhook/url zabbix '{
  "type": "trigger",
  "notifyType": "detailed",
  "hostname": "{HOST.NAME}",
  "tName": "{TRIGGER.NAME}",
  "tSeverity": "{TRIGGER.SEVERITY}",
  "tDescription": "{TRIGGER.DESCRIPTION}",
  "tStatus": "{TRIGGER.STATUS}",
  "tUrl": "{TRIGGER.ID}&eventid={EVENT.ID}",
  "tValue": "{TRIGGER.VALUE}",
  "iName1": "{ITEM.NAME1}",
  "iName2": "{ITEM.NAME2}",
  "iName3": "{ITEM.NAME3}",
  "iName4": "{ITEM.NAME4}",
  "iValue1": "{ITEM.VALUE1}",
  "iValue2": "{ITEM.VALUE2}",
  "iValue3": "{ITEM.VALUE3}",
  "iValue4": "{ITEM.VALUE4}"

you can always enable debug $debug = 1; and you should get what you need out of it defaults to /tmp/zabbix-mattermost.log

good luck

More Information

You can’t perform that action at this time.