bundles/backup-server: add metadata backup-client/one_backup_every_hours
This commit is contained in:
parent
9a8e7abef4
commit
5d7872042b
3 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,7 @@ from sys import argv, exit
|
|||
from time import time
|
||||
|
||||
NODE = argv[1]
|
||||
ONE_BACKUP_EVERY_HOURS = argv[2]
|
||||
|
||||
NOW = int(time())
|
||||
DAY_SECONDS = 60 * 60 * 24
|
||||
|
@ -45,9 +46,9 @@ try:
|
|||
# One day without backups is still okay. There may be fluctuations
|
||||
# because of transfer speed, amount of data, changes in backup
|
||||
# schedule etc.
|
||||
if delta > (DAY_SECONDS * 3):
|
||||
if delta > (DAY_SECONDS * (ONE_BACKUP_EVERY_HOURS + 2)):
|
||||
exit(2)
|
||||
elif delta > (DAY_SECONDS * 2):
|
||||
elif delta > (DAY_SECONDS * (ONE_BACKUP_EVERY_HOURS + 1)):
|
||||
exit(1)
|
||||
else:
|
||||
exit(0)
|
||||
|
|
|
@ -31,6 +31,7 @@ def get_my_clients(metadata):
|
|||
|
||||
my_clients[rnode.name] = {
|
||||
'user': rnode.metadata.get('backup-client/user-name'),
|
||||
'one_backup_every_hours': rnode.metadata.get('backup-client/one_backup_every_hours', 24),
|
||||
'retain': {
|
||||
'daily': rnode.metadata.get('backups/retain/daily', retain_defaults['daily']),
|
||||
'weekly': rnode.metadata.get('backups/retain/weekly', retain_defaults['weekly']),
|
||||
|
@ -143,7 +144,10 @@ def monitoring(metadata):
|
|||
continue
|
||||
|
||||
services[f'BACKUPS FOR NODE {client}'] = {
|
||||
'command_on_monitored_host': f'sudo /usr/local/share/icinga/plugins/check_backup_for_node {client}',
|
||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_backup_for_node {} {}'.format(
|
||||
client,
|
||||
config['one_backup_every_hours'],
|
||||
),
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -26,6 +26,10 @@ nodes['kunsi-p14s'] = {
|
|||
},
|
||||
},
|
||||
},
|
||||
'backup-client': {
|
||||
# only alert people if we're missing more than a week of backups
|
||||
'one_backup_every_hours': 7 * 24,
|
||||
},
|
||||
'firewall': {
|
||||
'port_rules': {
|
||||
# obs websocket thingie - just allow all RFC1918 ips here
|
||||
|
|
Loading…
Reference in a new issue