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) count = calculate_count(s_checks)
server = dict(name=site, url=s['url'], server = dict(name=site, url=s['url'],
result=s_checks, s_rate=count) result=s_checks, s_rate=count)
print(server)
output.append(server) output.append(server)
#print(output)
print(datetime.datetime.now()) print(datetime.datetime.now())
return(output) return(output)

View File

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