How sown/backup works
SOWN Backup selects NetBox hosts tagged for backup, then provisions a local ZFS dataset, reads remote exclusions and runs hooks, synchronizes the host filesystem, rotates snapshots, and reports successful completion to Icinga. The CLI also supports a forced single-host run. Paths and calls are grounded in the sampled source; the README documents the scheduled operation and ZFS snapshot exposure, but no separate scheduler implementation is present in this repository.
Main entry points: backup.py Host backup · cli.py Backup CLI · rotation.py Snapshot rotation · icinga.py Icinga reporter
Components 17
Host selection
- Backup CLI
backup/cli.py - NetBox client
backup/netbox.py
Backup execution
- Host backup
backup/backup.py - rsync process
- Standard excludes
backup/excludes.py
Snapshots and storage
- ZFS commands
backup/zfs.py - Snapshot rotation
backup/rotation.py - Rotation schedule
backup/schedules.py
Monitoring and logs
- Runtime config
backup/config.example.py - Icinga reporter
backup/icinga.py - Logger setup
backup/logconfig.py
Other components
- Operator or cron
- NetBox
- Backup host
- ZFS datasets
- Icinga API
- Syslog
Connections 21
- Operator or cron → Backup CLI: invokes
- Backup CLI → NetBox client: requests hosts
- NetBox client → NetBox: queries
- Backup CLI → Host backup: dispatches backup
- Backup CLI → Logger setup: sets up logging
- Logger setup → Syslog: writes logs
- Host backup → Backup host: reads excludes; runs hooks
- Host backup → Standard excludes: reads
- Host backup → ZFS commands: checks or creates dataset
- Host backup → rsync process: runs sync
- rsync process → Backup host: reads root filesystem
- rsync process → ZFS datasets: writes backup files
- Host backup → Snapshot rotation: rotates after sync
- Snapshot rotation → Rotation schedule: reads schedule
- Snapshot rotation → ZFS commands: lists, snapshots, deletes
- ZFS commands → ZFS datasets: manages datasets
- Host backup → Icinga reporter: reports successful backup
- Icinga reporter → Icinga API: posts check result
- Host backup → Runtime config: reads hostname setting
- Icinga reporter → Runtime config: reads API settings
- Snapshot rotation → Runtime config: reads rotation settings