summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check-sth.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/check-sth.py b/tools/check-sth.py
index da52575..507c447 100755
--- a/tools/check-sth.py
+++ b/tools/check-sth.py
@@ -9,6 +9,7 @@ import argparse
import json
import errno
import shutil
+import base64
from datetime import datetime, timedelta, tzinfo
from certtools import get_sth
@@ -68,13 +69,12 @@ class UTC(tzinfo):
def check_age(sth):
now = datetime.now(UTC())
sth_time = datetime.fromtimestamp(sth['timestamp'] / 1000, UTC())
+ roothash = base64.b16encode(base64.decodestring(sth['sha256_root_hash']))
if now > sth_time + timedelta(0, 6 * 3600):
- print "CRITICAL: %s is older than 6h: %s UTC" % \
- (sth['sha256_root_hash'], sth_time)
+ print "CRITICAL: %s is older than 6h: %s UTC" % (roothash, sth_time)
sys.exit(NAGIOS_CRIT)
if now > sth_time + timedelta(0, 2 * 3600):
- print "WARNING: %s is older than 2h: %s UTC" % \
- (sth['sha256_root_hash'], sth_time)
+ print "WARNING: %s is older than 2h: %s UTC" % (roothash, sth_time)
sys.exit(NAGIOS_WARN)
def check_treesize(cur, prev):