From 34fd84e7e414e8a72fee25a2f91d3cd189ad30a1 Mon Sep 17 00:00:00 2001 From: Josef Gustafsson Date: Fri, 4 Sep 2015 09:19:40 +0200 Subject: Bugfix for nagios plugin --- tools/josef_nagios_auditor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tools/josef_nagios_auditor.py') diff --git a/tools/josef_nagios_auditor.py b/tools/josef_nagios_auditor.py index 05390f8..41fefd0 100755 --- a/tools/josef_nagios_auditor.py +++ b/tools/josef_nagios_auditor.py @@ -147,13 +147,13 @@ def verify_consistency(url, old, new): print time.strftime('%H:%M:%S') + " Verification of old hash failed! " + old["sha256_root_hash"] + str(base64.b64encode(res[0])) sys.exit(NAGIOS_CRIT) # errors.append(time.strftime('%H:%M:%S') + " ERROR: Failed to verify consistency for " + url + ", tree size " + old[url]["tree_size"]) - elif new[url]["sha256_root_hash"] != str(base64.b64encode(res[1])): + elif new["sha256_root_hash"] != str(base64.b64encode(res[1])): print time.strftime('%H:%M:%S') + " Verification of new hash failed! " + new["sha256_root_hash"] + str(base64.b64encode(res[1])) sys.exit(NAGIOS_CRIT) # errors.append(time.strftime('%H:%M:%S') + " ERROR: Failed to verify consistency for " + url + ", tree size " + new[url]["tree_size"]) - else: - print time.strftime("%H:%M:%S") + " New STH from " + url + ", timestamp: " + \ - str(new["timestamp"]) + ", size: " + str(new["tree_size"]) + "...OK." + # else: + # print time.strftime("%H:%M:%S") + " New STH from " + url + ", timestamp: " + \ + # str(new["timestamp"]) + ", size: " + str(new["tree_size"]) + "...OK." except: print time.strftime('%H:%M:%S') + " ERROR: Could not verify consistency for " + url @@ -164,8 +164,8 @@ def verify_inclusion_all(url, old, new): try: if old["tree_size"]!= new["tree_size"]: entries = [] - while len(entries) + old[url]["tree_size"]!= new[url]["tree_size"]: - entries += get_entries(url, str(int(old[url]["tree_size"]) + len(entries)), new[url]["tree_size"] -1)["entries"] + while len(entries) + old["tree_size"]!= new["tree_size"]: + entries += get_entries(url, str(int(old["tree_size"]) + len(entries)), new["tree_size"] -1)["entries"] success = True for i in entries: -- cgit v1.1