Update to python3
This commit is contained in:
parent
b136bbeb5a
commit
f58707010a
|
@ -30,7 +30,7 @@ output = []
|
||||||
|
|
||||||
def calculate_count(data):
|
def calculate_count(data):
|
||||||
count = {}
|
count = {}
|
||||||
ls = data.values()
|
ls = list(data.values())
|
||||||
z, nz = 0, 0
|
z, nz = 0, 0
|
||||||
for v in ls:
|
for v in ls:
|
||||||
if v == 0:
|
if v == 0:
|
||||||
|
@ -67,14 +67,14 @@ def getMonit():
|
||||||
checks[name] = status[name]
|
checks[name] = status[name]
|
||||||
|
|
||||||
sorted_checks = OrderedDict()
|
sorted_checks = OrderedDict()
|
||||||
sorted_checks = OrderedDict(sorted(checks.iteritems(),
|
sorted_checks = OrderedDict(sorted(iter(checks.items()),
|
||||||
key=itemgetter(1), reverse=True))
|
key=itemgetter(1), reverse=True))
|
||||||
count = calculate_count(sorted_checks)
|
count = calculate_count(sorted_checks)
|
||||||
server = dict(name=site, url=s['url'],
|
server = dict(name=site, url=s['url'],
|
||||||
result=sorted_checks, s_rate=count)
|
result=sorted_checks, s_rate=count)
|
||||||
|
|
||||||
output.append(server)
|
output.append(server)
|
||||||
print(datetime.datetime.now())
|
print((datetime.datetime.now()))
|
||||||
return(output)
|
return(output)
|
||||||
|
|
||||||
# Classes
|
# Classes
|
||||||
|
|
|
@ -15,7 +15,7 @@ def generate_report_excel(output, filename):
|
||||||
worksheet.write('B1', 'Status', bold)
|
worksheet.write('B1', 'Status', bold)
|
||||||
row = 1
|
row = 1
|
||||||
col = 0
|
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)
|
worksheet.write_string(row, col, key)
|
||||||
if value == 0:
|
if value == 0:
|
||||||
status = 'OK'
|
status = 'OK'
|
||||||
|
|
Loading…
Reference in a new issue