Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Latest commit

 

History

History
33 lines (23 loc) · 1.24 KB

README.md

File metadata and controls

33 lines (23 loc) · 1.24 KB

Matrix Zabbix bot

This is a simple project of making the Zabbix API available into Matrix.

For this the pyzabbix and the matrix-python-sdk are used.

Matrix SDK wrapper

The Matrix SDK wrapper script makes sending messages to a Matrix room easier. For example:

python3 matrix.py -c matrix_example.yaml Hello I am a test message

Sends a test message to the room configured in the matrix_example.yaml file.

Zabbix API wrapper

While the pyzabbix itself is a wrapper, I wrote a wrapper for pyzabbix to make the code for the bot itself easier. In the zabbix.py file all the functions for retrieving the triggers and acknowledging them are defined.

Matrix Zabbix bot

The actual bot is defined in zabbix_bot.py. This bot listens for any message beginning with !zabbix. Without any argument it lists the unacknowledged triggers. !zabbix all list all triggers, acknowledged and unacknowledged. !zabbix acked lists only the acknowledged triggers. The format of each trigger line is:

{priority} {hostname} {description} {lastvalue} ({trigger-id})

This trigger-id can be used to acknowledge triggers by issuing:

!zabbix ack {trigger-id}