bundles/zfs: run scrub for each pool separately

This commit is contained in:
Franzi 2022-04-03 09:48:28 +02:00
parent 4823653214
commit 5640556ad9
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -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',
)