diff options
-rwxr-xr-x | nagios-checks/nagios-check-rdiff-backup | 12 |
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) |