add few corrections

This commit is contained in:
saravanan palanisamy 2019-08-14 15:10:54 +04:00
parent 5360ec9e87
commit afe4bce47b

View file

@ -28,8 +28,6 @@ output = []
def getMonit(): def getMonit():
output = [] output = []
server = {}
checks = OrderedDict()
xmlQuery = "/_status?format=xml" xmlQuery = "/_status?format=xml"
with open('{0}/conf/servers.json'.format(os.path.expanduser('.'))) as f: with open('{0}/conf/servers.json'.format(os.path.expanduser('.'))) as f:
@ -44,12 +42,13 @@ def getMonit():
services = allstat['service'] services = allstat['service']
status = {} status = {}
server = {}
checks = OrderedDict() checks = OrderedDict()
for service in services: for service in services:
name = service['name'] name = service['name']
status[name] = int(service['status']) status[name] = int(service['status'])
checks[service['name']] = status[name] checks[name] = status[name]
sorted_checks = OrderedDict() sorted_checks = OrderedDict()
sorted_checks = OrderedDict(sorted(checks.iteritems(), key=itemgetter(1), reverse=True)) sorted_checks = OrderedDict(sorted(checks.iteritems(), key=itemgetter(1), reverse=True))