X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=dsa-nagios-checks%2Fchecks%2Fdsa-check-backuppg;h=0ce4d9501e67a8a78a8637fb62fb17d22e8fd8a6;hb=cf352367b4afe5b0849258030b3640c963b6828a;hp=92ce6cb6731bfdbb08ecc843ee3f8efbfad8b74c;hpb=3e579ecf2993b0d53b52d9cf5f2b65f65d56058e;p=mirror%2Fdsa-nagios.git diff --git a/dsa-nagios-checks/checks/dsa-check-backuppg b/dsa-nagios-checks/checks/dsa-check-backuppg index 92ce6cb..0ce4d95 100755 --- a/dsa-nagios-checks/checks/dsa-check-backuppg +++ b/dsa-nagios-checks/checks/dsa-check-backuppg @@ -65,6 +65,7 @@ def load_conf(cf): return config +notices_seq = [] problems_seq = [] problems_per_db = {} global_expires = [] @@ -75,6 +76,12 @@ global_expires = [] # global problems_per_db # if not host in problems_per_db: problems_per_db[host] = {} # problems_per_db[host][db] = True +def note_info(key, value, pre=None): + global notices_seq + if pre is None: + notices_seq.append("%s: %s"%(key, value)) + else: + notices_seq.append("[%s] %s: %s"%(pre, key, value)) def note_warning(key, value, pre=None): global problems_seq @@ -131,8 +138,15 @@ config = load_conf(options.conffile) os.chdir(config['rootdir']) for dir in os.listdir('.'): + if dir.startswith('.') or dir.endswith('.old'): + note_info('IGNORED', dir) + continue + if not os.path.isdir(dir): - note_warning('NOT-A-DIR', dir) + if min(os.path.getmtime(dir), os.path.getctime(dir)) + 3600*4 > time.time(): + note_info('IGNORED', dir) + else: + note_warning('NOT-A-DIR', dir) continue if not dir in config['backups']: @@ -302,6 +316,8 @@ for dir in os.listdir('.'): for p in problems_seq: print p +for p in notices_seq: + print p if options.expire: for f in global_expires: