From cbab82948b7cb0fdbe5d576fece8acf9a5715265 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 22 Apr 2011 14:24:47 +0200 Subject: [PATCH] dsa-check-backuppg: ignore regular files in pg backup's root directory if they are still fresh --- dsa-nagios-checks/checks/dsa-check-backuppg | 14 +++++++++++++- dsa-nagios-checks/debian/changelog | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dsa-nagios-checks/checks/dsa-check-backuppg b/dsa-nagios-checks/checks/dsa-check-backuppg index 92ce6cb..ccf9e3d 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 @@ -132,7 +139,10 @@ config = load_conf(options.conffile) os.chdir(config['rootdir']) for dir in os.listdir('.'): 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 +312,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: diff --git a/dsa-nagios-checks/debian/changelog b/dsa-nagios-checks/debian/changelog index 54bbaea..6952eb8 100644 --- a/dsa-nagios-checks/debian/changelog +++ b/dsa-nagios-checks/debian/changelog @@ -3,8 +3,11 @@ dsa-nagios-checks (9X) Xnstable; urgency=low * dsa-check-entropy: - document watermark default - fix off-by-one in output + * dsa-check-backuppg: + - ignore regular files in pg backup's root directory if they are still + fresh. - -- Peter Palfrader Mon, 28 Mar 2011 15:54:21 +0200 + -- Peter Palfrader Fri, 22 Apr 2011 14:24:16 +0200 dsa-nagios-checks (89) unstable; urgency=low -- 2.20.1