add granular view in frontend

This commit is contained in:
saravanan30erd 2020-02-25 20:13:45 +04:00
parent 0bdf6d0f58
commit a0ccc34f2a
2 changed files with 47 additions and 34 deletions

View File

@ -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)

View File

@ -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)
<a href="$output[server]['url']" target="_blank">$output[server]['name']</a>
</th></tr>
</thead>
$for check in output[server]['result'].keys():
$ isError = output[server]['result'].get(check)
$if isError != 0:
<tr>
<td><a href="$output[server]['url']/$check"
target="_blank">$check</a></td>
<td><a href="$output[server]['url']/$check"
target="_blank"><img src="static/img/error.png"></a></td>
</tr>
$else:
<tr>
<td>$check</td>
<td><img src="static/img/ok.png"></td>
</tr>
$for env, services in output[server]['result'].items():
<thead class="server-link">
<tr><th colspan="2">
<a href="$output[server]['url']" target="_blank">$env</a>
</th></tr>
</thead>
$for check in services.keys():
$ isError = services.get(check)
$if isError != 0:
<tr>
<td><a href="$output[server]['url']/$env-$check"
target="_blank">$check</a></td>
<td><a href="$output[server]['url']/$check"
target="_blank"><img src="static/img/error.png"></a></td>
</tr>
$else:
<tr>
<td>$check</td>
<td><img src="static/img/ok.png"></td>
</tr>
</table>
</div>
@ -62,20 +69,26 @@ $def with (output, now)
<a href="$output[server]['url']" target="_blank">$output[server]['name']</a>
</th></tr>
</thead>
$for check in output[server]['result'].keys():
$ isError = output[server]['result'].get(check)
$if isError != 0:
<tr>
<td><a href="$output[server]['url']/$check"
target="_blank">$check</a></td>
<td><a href="$output[server]['url']/$check"
target="_blank"><img src="static/img/error.png"></a></td>
</tr>
$else:
<tr>
<td>$check</td>
<td><img src="static/img/ok.png"></td>
</tr>
$for env, services in output[server]['result'].items():
<thead class="server-link">
<tr><th colspan="2">
<a href="$output[server]['url']" target="_blank">$env</a>
</th></tr>
</thead>
$for check in services.keys():
$ isError = services.get(check)
$if isError != 0:
<tr>
<td><a href="$output[server]['url']/$check"
target="_blank">$check</a></td>
<td><a href="$output[server]['url']/$check"
target="_blank"><img src="static/img/error.png"></a></td>
</tr>
$else:
<tr>
<td>$check</td>
<td><img src="static/img/ok.png"></td>
</tr>
</table>
</div>