https://github.com/snawoot/transmission-monitor
Tool to track Transmission torrents state
https://github.com/snawoot/transmission-monitor
transmission transmission-daemon transmission-rpc
Last synced: about 1 month ago
JSON representation
Tool to track Transmission torrents state
- Host: GitHub
- URL: https://github.com/snawoot/transmission-monitor
- Owner: Snawoot
- License: mit
- Created: 2022-06-04T20:09:16.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-04T08:29:02.000Z (3 months ago)
- Last Synced: 2025-02-04T09:30:09.677Z (3 months ago)
- Topics: transmission, transmission-daemon, transmission-rpc
- Language: Go
- Homepage:
- Size: 154 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# transmission-monitor
Tool to track Transmission torrents state. Intended to be run as a cron job each few minutes. Interacts with Transmission RPC and notifies (via external command) about unhealthy torrents once.
For each faulty torrent external command gets fed via stdin with JSON describing the problem and the torrent. If command succeeds (zero exit code), notification delivery is considered successful and will not repeated again. Otherwise notification delivery will be retried on next run. You may clear entire database or remove single key.
Remote RPC must be enabled in Transmission for this program to work.
## Installation
#### Binaries
Pre-built binaries are available [here](https://github.com/Snawoot/transmission-monitor/releases/latest).
#### Build from source
Alternatively, you may install transmission-monitor from source. Run the following within the source directory:
```
make install
```## Configuration
Configuration example:
#### /home/user/.config/transmission-monitor.yaml
```yaml
rpc:
user: transmissionuser
password: transmissionpassword
notify:
command:
- /home/user/.config/transmission-notify.sh
```Please consult [source](cmd/transmission-monitor/defaults.go) for all available configuration options.
#### /home/user/.config/transmission-notify.sh
```bash
#!/bin/bashset -euo pipefail
jq -r '"There is a problem with following torrent:\n\nName: \"" + .torrent.name + "\"\nHash: " + .torrent.hashString + "\nComment: " + .torrent.comment + "\nCause: " + .reason' | \
mailx -v \
-r "[email protected]" \
-s "Torrent requires attention" \
-S smtp="mx.example.com:587" \
-S smtp-use-starttls \
-S smtp-auth=login \
-S smtp-auth-user="[email protected]" \
-S smtp-auth-password="mailpassword" \
[email protected]
```Make sure to run `transmission-monitor` command every few minutes with scheduler of your choice. Example for systemd timer and service:
```
$ systemctl --user cat transmission-monitor.service transmission-monitor.timer
# /home/user/.config/systemd/user/transmission-monitor.service
[Unit]
Description=Transmission torrent state monitor
Wants=transmission-monitor.timer
After=network-online.target[Service]
Type=oneshot
ExecStart=/home/user/go/bin/transmission-monitor
TimeoutStartSec=3 min[Install]
WantedBy=multi-user.target# /home/user/.config/systemd/user/transmission-monitor.timer
[Unit]
Description=transmission-monitor periodic job
RefuseManualStart=no
RefuseManualStop=no[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
Persistent=true[Install]
WantedBy=timers.target
```## Synopsis
```
$ ./bin/transmission-monitor -h
Usage of transmission-monitor:
-clear-db
clear database
-clear-key string
delete specified hash from database
-conf string
path to configuration file (default "/home/user/.config/transmission-monitor.yaml")
-get-key string
dump key content from database
-list-keys
list keys in database
-version
show program version and exit
```