diff --git a/bundles/zfs/metadata.py b/bundles/zfs/metadata.py index 8ed8561..001d7ab 100644 --- a/bundles/zfs/metadata.py +++ b/bundles/zfs/metadata.py @@ -84,10 +84,6 @@ defaults = { 'when': 'weekly', 'command': '/usr/local/sbin/zfs-auto-snapshot weekly', }, - 'zfs-scrub': { - 'when': 'Sun 02:00:00 UTC', - 'command': '/usr/lib/zfs-linux/scrub', - } }, }, 'zfs': { @@ -136,6 +132,23 @@ if node.has_bundle('telegraf'): } +@metadata_reactor.provides( + 'systemd-timers/timers/zfs-scrub', +) +def scrub_timer(metadata): + scrubs = [f'zpool scrub {pool}' for pool in sorted(metadata.get('zfs/pools', {}))] + return { + 'systemd-timers': { + 'timers': { + 'zfs-scrub': { + 'when': 'Sun 02:00:00 UTC', + 'command': scrubs, + }, + }, + }, + } + + @metadata_reactor.provides( 'icinga2_api/zfs/services', )