diff --git a/bin/monit-dashboard.py b/bin/monit-dashboard.py index 71de7de..dc94b6a 100755 --- a/bin/monit-dashboard.py +++ b/bin/monit-dashboard.py @@ -83,8 +83,8 @@ def getMonit(): count = calculate_count(s_checks) server = dict(name=site, url=s['url'], result=s_checks, s_rate=count) - print(server) output.append(server) + #print(output) print(datetime.datetime.now()) return(output) diff --git a/templates/index.html b/templates/index.html index 002a631..3ec678c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,11 +13,12 @@ $def with (output, now) errors = 0 color = "green" - $for check in output[server]['result'].keys(): - $ isError = output[server]['result'].get(check) - $if isError != 0: - $code: - errors=errors+1 + $for _,v in output[server]['result'].items(): + $for check in v.keys(): + $ isError = v.get(check) + $if isError != 0: + $code: + errors=errors+1 $if errors > 0: $code: @@ -32,20 +33,26 @@ $def with (output, now) $output[server]['name'] - $for check in output[server]['result'].keys(): - $ isError = output[server]['result'].get(check) - $if isError != 0: - - $check - - - $else: - - $check - - + $for env, services in output[server]['result'].items(): + + + $env + + + $for check in services.keys(): + $ isError = services.get(check) + $if isError != 0: + + $check + + + $else: + + $check + + @@ -62,20 +69,26 @@ $def with (output, now) $output[server]['name'] - $for check in output[server]['result'].keys(): - $ isError = output[server]['result'].get(check) - $if isError != 0: - - $check - - - $else: - - $check - - + $for env, services in output[server]['result'].items(): + + + $env + + + $for check in services.keys(): + $ isError = services.get(check) + $if isError != 0: + + $check + + + $else: + + $check + +