murlock1000 / zabbix-matrix-script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zabbix-matrix-script

This script sends E2EE (End-to-end encryption) notifications to Matrix server from Zabbix.

Installation

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.

Notes

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.

Dependencies

  1. matrix-js-sdk for matrix communications.
  2. JS Olm binding for the E2EE implementation.
  3. node-localstorage as a replacement for Web Storage session store.

Docker support

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.

About


Languages

Language:JavaScript 79.6%Language:Shell 14.4%Language:Dockerfile 6.0%