summaryrefslogtreecommitdiff
path: root/nagios-checks/nagios-check-rdiff-backup
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2021-06-22 12:03:37 +0200
committerPeter Palfrader <peter@palfrader.org>2021-06-22 12:03:37 +0200
commit50f3deeddc6394b99e9e72a8461c5062f55c6375 (patch)
tree27d1587442353ed141b05ca15277198b3095549b /nagios-checks/nagios-check-rdiff-backup
parent4f9b2d8f679f98cb7a9db8d62471d1bc009d6693 (diff)
Move nagios-check-rdiff-backup to py3HEADmaster
Diffstat (limited to 'nagios-checks/nagios-check-rdiff-backup')
-rwxr-xr-xnagios-checks/nagios-check-rdiff-backup12
1 files changed, 6 insertions, 6 deletions
diff --git a/nagios-checks/nagios-check-rdiff-backup b/nagios-checks/nagios-check-rdiff-backup
index 1f8b30b..03dc782 100755
--- a/nagios-checks/nagios-check-rdiff-backup
+++ b/nagios-checks/nagios-check-rdiff-backup
@@ -1,6 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python3
-# Copyright 2010, 2011 Peter Palfrader
+# Copyright 2010, 2011, 2021 Peter Palfrader
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -53,7 +53,7 @@ def code_to_prefix(code):
elif code == 2: return 'CRITICAL: '
elif code == 1: return 'WARNING: '
elif code == 0: return 'OK: '
- else: raise ValueError
+ else: raise ValueError("Unknown code %s"%(str(code),))
def convert_time(s, default_unit='h'):
m = re.match('([0-9]+)([smhdw])?$', s)
@@ -143,12 +143,12 @@ def record(code, base, msg):
backup_per_code[code].append(base)
report = []
-keys = backup_per_code.keys()
+keys = list(backup_per_code.keys())
keys.sort(reverse=True)
for code in keys:
prefix = code_to_prefix(code)
report.append( prefix + ', '.join(backup_per_code[code]) )
if not options.quiet:
- print '; '.join(report)
- for l in log: print l
+ print('; '.join(report))
+ for l in log: print(l)
sys.exit(exitcode)