diff options
author | Peter Palfrader <peter@palfrader.org> | 2021-06-22 12:03:37 +0200 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2021-06-22 12:03:37 +0200 |
commit | 50f3deeddc6394b99e9e72a8461c5062f55c6375 (patch) | |
tree | 27d1587442353ed141b05ca15277198b3095549b | |
parent | 4f9b2d8f679f98cb7a9db8d62471d1bc009d6693 (diff) |
-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) |