diff --git a/bin/monit-dashboard.py b/bin/monit-dashboard.py index d502b1a..026bc0b 100755 --- a/bin/monit-dashboard.py +++ b/bin/monit-dashboard.py @@ -30,7 +30,7 @@ output = [] def calculate_count(data): count = {} - ls = data.values() + ls = list(data.values()) z, nz = 0, 0 for v in ls: if v == 0: @@ -67,14 +67,14 @@ def getMonit(): checks[name] = status[name] sorted_checks = OrderedDict() - sorted_checks = OrderedDict(sorted(checks.iteritems(), + sorted_checks = OrderedDict(sorted(iter(checks.items()), key=itemgetter(1), reverse=True)) count = calculate_count(sorted_checks) server = dict(name=site, url=s['url'], result=sorted_checks, s_rate=count) output.append(server) - print(datetime.datetime.now()) + print((datetime.datetime.now())) return(output) # Classes diff --git a/bin/utils.py b/bin/utils.py index e318a75..68c09f5 100644 --- a/bin/utils.py +++ b/bin/utils.py @@ -15,7 +15,7 @@ def generate_report_excel(output, filename): worksheet.write('B1', 'Status', bold) row = 1 col = 0 - for key, value in output[server]['result'].items(): + for key, value in list(output[server]['result'].items()): worksheet.write_string(row, col, key) if value == 0: status = 'OK'