Python script with systemd units to watch for failed services
This script will use systemd --failed
to retrieve failed services
and post them to the slack team and channel you specify
To use SystemWatchSlack you first have to set your team and channel in systemd-watcher.py
Afterward copy the systemd timer and service file to your systemd directory
# cp watch-systemd.* /etc/systemd/system/
Now enable and start the timer
# systemctl enable watch-systemd.timer
# systemctl start watch-systemd.timer
By default the timer will start the script every 10 minutes and 30 seconds after reboot. You can change this in watch-systemd.timer.
Change start time after reboot to 20 seconds
OnBootSec=20sec
Change intervall to every week
OnUnitActiveSec=1w