projects
/
mirror
/
dsa-nagios.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ubc-enc2bl10 on stretch
[mirror/dsa-nagios.git]
/
dsa-nagios-checks
/
checks
/
dsa-check-backuppg
diff --git
a/dsa-nagios-checks/checks/dsa-check-backuppg
b/dsa-nagios-checks/checks/dsa-check-backuppg
index
10d0033
..
ca6c159
100755
(executable)
--- a/
dsa-nagios-checks/checks/dsa-check-backuppg
+++ b/
dsa-nagios-checks/checks/dsa-check-backuppg
@@
-62,7
+62,7
@@
def load_conf(cf):
configfile = '/etc/nagios/dsa-check-backuppg.conf'
f = open(configfile)
configfile = '/etc/nagios/dsa-check-backuppg.conf'
f = open(configfile)
- config = yaml.load(f.read())
+ config = yaml.
safe_
load(f.read())
f.close()
return config
f.close()
return config
@@
-173,7
+173,7
@@
for dir in os.listdir('.'):
files.sort()
files.sort()
-
unhandled_backup
s = copy.copy(config['backups'][dir])
+
notyetseen_db
s = copy.copy(config['backups'][dir])
ignored_dbs = {}
backup_state = {}
ignored_dbs = {}
backup_state = {}
@@
-195,7
+195,7
@@
for dir in os.listdir('.'):
continue
(db, type) = r.groups(1)
continue
(db, type) = r.groups(1)
- if not isinstance(config['backups'][dir],
lis
t) or not db in config['backups'][dir]:
+ if not isinstance(config['backups'][dir],
dic
t) or not db in config['backups'][dir]:
if not db in ignored_dbs:
note_warning_db(dir, db, 'NOT-CONFIGURED', '%s/%s'%(dir, db))
ignored_dbs[db] = True
if not db in ignored_dbs:
note_warning_db(dir, db, 'NOT-CONFIGURED', '%s/%s'%(dir, db))
ignored_dbs[db] = True
@@
-211,6
+211,10
@@
for dir in os.listdir('.'):
# can_expire_next: Can expire all files that we handle from now on
backup_state[db]['can_expire_next'] = False
backup_state[db]['expires'] = []
# can_expire_next: Can expire all files that we handle from now on
backup_state[db]['can_expire_next'] = False
backup_state[db]['expires'] = []
+ if isinstance(config['backups'][dir][db], dict) and 'timeline' in config['backups'][dir][db]:
+ backup_state[db]['timeline'] = config['backups'][dir][db]['timeline']
+ else:
+ backup_state[db]['timeline'] = 1
# Apparently we already have seen a base backup and all its wal files
# which we want to keep, so everything what we see now is older than
# Apparently we already have seen a base backup and all its wal files
# which we want to keep, so everything what we see now is older than
@@
-242,6
+246,7
@@
for dir in os.listdir('.'):
else:
note_warning_db(dir, db, 'MISSING-BASE', basefn)
continue
else:
note_warning_db(dir, db, 'MISSING-BASE', basefn)
continue
+ if db in notyetseen_dbs: del notyetseen_dbs[db]
files.remove(basefn)
if backup_state[db]['can_expire_next']:
backup_state[db]['expires'].append(baseffn)
files.remove(basefn)
if backup_state[db]['can_expire_next']:
backup_state[db]['expires'].append(baseffn)
@@
-273,8
+278,8
@@
for dir in os.listdir('.'):
backup_state[db]['can_expire_next'] = True
(timeline, wal1, wal2) = map(lambda x: int(x,16), r.groups())
backup_state[db]['can_expire_next'] = True
(timeline, wal1, wal2) = map(lambda x: int(x,16), r.groups())
- if not timeline ==
1
:
- note_warning_db(dir, db, '
CANNOT-HANDLE-TIMELINES_NOT_1
', ffn)
+ if not timeline ==
backup_state[db]['timeline']
:
+ note_warning_db(dir, db, '
UNEXPECTED-TIMELINE
', ffn)
continue
thissegment = (wal1, wal2)
continue
thissegment = (wal1, wal2)
@@
-323,6
+328,9
@@
for dir in os.listdir('.'):
for f in backup_state[db]['expires']:
global_expires.append(f)
for f in backup_state[db]['expires']:
global_expires.append(f)
+ for db in notyetseen_dbs:
+ note_warning_db(dir, db, 'NO-BACKUP', 'no backups! (no .backup files found)')
+
#if not db in backup_state:
# note_warning('BASE-WITHOUT-WAL', ffn)
# ignored_dbs[db] = True
#if not db in backup_state:
# note_warning('BASE-WITHOUT-WAL', ffn)
# ignored_dbs[db] = True