A simple shell script that monitors systemd units and sends notifications via ntfy when it detects failed or degraded services.
- Monitors systemd units for failed or degraded states
- Sends detailed notifications including unit status via ntfy
- Configurable notification endpoint
- High priority notifications with warning tags
- zsh shell
- systemd
- curl
- An ntfy server or subscription (for notifications)
- Clone this repository
- Make the script executable:
chmod +x ntfy_sydtemd_outages.sh
Run the script manually by passing your ntfy topic as an argument:
./ntfy_sydtemd_outages.sh https://ntfy.sh/your-topic
To test without sending notifications, use 'print':
./ntfy_sydtemd_outages.sh print
For automated monitoring, set up a cron job or systemd timer.
Example crontab entry (check every 5 minutes):
*/5 * * * * /path/to/ntfy_sydtemd_outages.sh https://ntfy.sh/your-topic
When a problematic unit is detected, you'll receive a notification with:
- Unit name
- Current status
- Detailed information from systemctl
- High priority flag
- Warning tag for visibility
GPLv3
Feel free to open issues or submit pull requests for improvements.