$for server in range(len(output)):
$code:
errors = 0
color = "green"
$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:
color = "red"
$for env, services in output[server]['result'].items():
$ errors = 0
$for check in services.keys():
$ isError = services.get(check)
$if isError != 0:
$ errors=errors+1
$if errors > 0:
$code:
color = "red"
txt = "{}: {} error(s)".format(env, errors)
$:table_contents(color, txt, services)
$else:
$code:
color = "green"
$:table_contents(color, env, services)
$else:
$code:
color = "green"
$for env, services in output[server]['result'].items():
$ errors = 0
$for check in services.keys():
$ isError = services.get(check)
$if isError != 0:
$ errors=errors+1
$if errors > 0:
$code:
color = "red"
txt = "{}: {} error(s)".format(env, errors)
$:table_contents(color, txt, services)
$else:
$ color = "green"
$:table_contents(color, env, services)