Simple bot for small homeservers
This is a simple Matrix bot based on matrix-python-sdk with no support and no warranty. It was forked from 4nd3r/tiny-matrix-bot.
It is easy to understand, little code, and easy to set up and extend to your personal needs. It is meant for small private Matrix homeservers that are run by individuals for their friends. It is not performant and hence not suitable for industrial size roll-out. The bot itself is just a single Python file. Bot commands are implemented as Bash scripts or Python programs. It is a good tool to learn about bots and to change it to adapt it to your personal needs.
Installation and Setup
sudo apt install python3 python3-requests git clone https://github.com/8go/tiny-matrix-bot git clone https://github.com/matrix-org/matrix-python-sdk cd tiny-matrix-bot ln -s ../matrix-python-sdk/matrix_client cp tiny-matrix-bot.cfg.sample tiny-matrix-bot.cfg vim tiny-matrix-bot.cfg # adjust the config file, add token, etc. cp tiny-matrix-bot.service /etc/systemd/system vim /etc/systemd/system/tiny-matrix-bot.service # adjust service to your setup systemctl enable tiny-matrix-bot systemctl start tiny-matrix-bot systemctl stop tiny-matrix-bot
Run something similar to
systemctl stop tiny-matrix-bot # stop server in case it is running cd tiny-matrix-bot # go to your installation directory ./tiny-matrix-bot.py --debug # observe debug output
Example bot commands provided
Additional bot commands provided to Matrix or system administrators
With these commands a system administrator can maintain his Matrix installation and keep a watchful eye on his server all through the Matrix bot. Set the permissions accordingly in the config file to avoid unauthorized use of these bot commands!
disks: see how full your disks or mountpoints are cputemp: monitor the CPU temperatures restart: restart the bot itself, or Matrix services check: check status, health status, updates, etc. of bot, Matrix and the operating system update: update operating sytem wake: wake up other PCs via LAN firewall: list the firewall settings and configuration date: gives date and time of server platform: gives hardware and operating system platform information ps: print current CPU, RAM and Disk utilization of server top: gives 5 top CPU and RAM consuming processes alert: shows if any CPU, RAM, or Disk thresholds have been exceeded (best to combine with a cron job, and have the cron job send the bot message to Matrix admin rooms)