Franziska Kunsmann
c185a5bacd
All checks were successful
bundlewrap/pipeline/head This commit looks good
There were still problems with systems starting their backups late in the hour, but backup servers did upgrade-and-reboot early it the hour. This leads to incomplete backups, if the machine is rebooting, too.
35 lines
989 B
Python
35 lines
989 B
Python
from hashlib import md5
|
|
|
|
defaults = {
|
|
'backup-client': {
|
|
# unix user names cannot be longer than 32 characters.
|
|
# bundlewrap raises an error if the name is longer than 30 chars.
|
|
'user-name': 'c-' + md5(node.name.encode('UTF-8')).hexdigest()[:28],
|
|
},
|
|
}
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
'cron/backup',
|
|
'icinga2_api/backup-client/services',
|
|
)
|
|
def cron(metadata):
|
|
if metadata.get('backups/exclude_from_backups', False):
|
|
return {}
|
|
|
|
return {
|
|
'cron': {
|
|
'backup': '{} 23 * * * root /usr/local/bin/generate-backup > /dev/null 2>&1'.format(
|
|
(node.magic_number % 60),
|
|
),
|
|
},
|
|
'icinga2_api': {
|
|
'backup-client': {
|
|
'services': {
|
|
'BACKUP LAST RUN': {
|
|
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_backup_last_run',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|