This script sends E2EE (End-to-end encryption) notifications to Matrix server from Zabbix.
Copy the zabbix-matrix-script folder to your Zabbix alert scripts directory. This is usually located in: /usr/lib/zabbix/alertscripts/
Perform the package installation in the resulting ../alertscripts/zabbix-matrix-script folder with npm install
.
Change the user id, password and homeserver parameters to appropriate values in config.json
.
Test out the script by sending a test message to a room. First, copy the internal room id of a room, which has the bot joined/invited. It can be found on the Element app in Room options -> Settings -> Advanced -> Room information.
Send out a test message with node . '!YOURROOMID:homeserver' 'Subject' 'Body'
.
Setting up Zabbix media type. First, import the zbx_export_mediatypes.yaml
file into your zabbix installation. Depending on the Zabbix server version, you might need to tweak the file before importing it.
Lastly, setup the Matrix E2EE media type for your zabbix user with Send to
value set to the internal room id.
Credentials in config.json
are used only on first login. We use the device ID and token in the store for successive logins. This stops the server from generating a new device each time we send a message.
- matrix-js-sdk for matrix communications.
- JS Olm binding for the E2EE implementation.
- node-localstorage as a replacement for Web Storage session store.
I found that the Olm library experienced issues with SSL verification when running the script on an Ubuntu 20.04 LTS machine. So I used an image created on a windows 10 machine.
This Image can be used by downloading it: docker pull murlock1000/zabbixmatrixscript:latest
And running the launchDocker.sh instead of launch.sh script.