https://github.com/thiswillbeyourgithub/ntfy_systemd
Get ntfy notifications when a systemd unit is degraded
https://github.com/thiswillbeyourgithub/ntfy_systemd
Last synced: 5 months ago
JSON representation
Get ntfy notifications when a systemd unit is degraded
- Host: GitHub
- URL: https://github.com/thiswillbeyourgithub/ntfy_systemd
- Owner: thiswillbeyourgithub
- License: gpl-3.0
- Created: 2024-12-06T17:49:09.000Z (about 1 year ago)
- Default Branch: github
- Last Pushed: 2025-09-10T08:14:15.000Z (6 months ago)
- Last Synced: 2025-09-10T11:56:55.093Z (6 months ago)
- Language: Shell
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Systemd Outage Notifier
A simple shell script that monitors systemd units and sends notifications via ntfy when it detects failed or degraded services.
## Features
- 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
## Prerequisites
- zsh shell
- systemd
- curl
- An ntfy server or subscription (for notifications)
## Setup
1. Clone this repository
2. Make the script executable:
```bash
chmod +x ntfy_sydtemd_outages.sh
```
## Usage
Run the script manually by passing your ntfy url/topic as an argument:
```bash
./ntfy_sydtemd_outages.sh ntfy.sh/your-topic
```
To test without sending notifications, use 'print':
```bash
./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 ntfy.sh/your-topic
```
## Notifications
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
## License
GPLv3
## Contributing
Feel free to open issues or submit pull requests for improvements.