From 926f4e135b33829fb27f89f2ce1c25e838667129 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 3 Apr 2013 11:50:08 +0200 Subject: [PATCH] If there are no backups, we get a single NULL answer --- dsa-nagios-checks/checks/dsa-check-bacula | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsa-nagios-checks/checks/dsa-check-bacula b/dsa-nagios-checks/checks/dsa-check-bacula index 35aade9..5f5e445 100755 --- a/dsa-nagios-checks/checks/dsa-check-bacula +++ b/dsa-nagios-checks/checks/dsa-check-bacula @@ -102,7 +102,7 @@ conn = psycopg2.connect(options.db) cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) cursor.execute(query, params) records = cursor.fetchall() -if len(records) == 0: +if len(records) == 0 or records[0][0] is None: print "CRITICAL: No backups of %s/%s."%(host, level) sys.exit(codes['CRITICAL']) elif len(records) > 1: -- 2.20.1