haproxy-wi/app/templates/ajax/smon_dashboard.html

165 lines
6.0 KiB
HTML

{% if update %}
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% endif %}
<div class="sort_menu">
<div style="margin-bottom: 15px">
{% set down = [] %}
{% set up = [] %}
{% set dis = [] %}
{% for s in smon %}
{% if s.en == 1 %}
{% if s.status == 1 and s.http_status == 1 and s.body_status == 1 %}
{% if up.append('1') %} {% endif %}
{% else %}
{% if down.append('1') %} {% endif %}
{% endif %}
{% else %}
{% if dis.append(s.group) %} {% endif %}
{% endif %}
{% endfor %}
<b>{{lang.smon_page.desc.status_summary}}: {{lang.smon_page.desc.UP}}: {{up|length}}, {{lang.smon_page.desc.DOWN}}: {{down|length}}, {{lang.words.disabled|title()}}: {{dis|length}}</b>
</div>
<a href="#" title="{{lang.smon_page.desc.do_not_sort_by_status}}" onclick="showSmon('not_sort')">{{lang.smon_page.desc.do_not_sort}}</a> |
<a href="#" id="sort_by_status" title="{{lang.smon_page.desc.sort_status}}" onclick="sort_by_status()">{{lang.smon_page.desc.sort_status}}</a> |
<a href="#" title="SMOM: {{lang.words.dashboard|title()}} - Roxy-WI" onclick="showSmon('refresh');">{{lang.words.refresh|title()}}</a>
</div>
{% set group = [] %}
{% set group_prev = [] %}
{%- for s in smon -%}
{% set checks = lang.smon_page.desc.enabled_checks +': <br>' + lang.phrases.port_check|title() %}
{% if s.http %}
{% set checks = checks + ',<br>' + lang.smon_page.desc.http_status_check + ': ' + s.http.split(':')[0]|string() + '://' + s.ip|string() + ':' + s.port|string() + s.http.split(':')[1]|string() %}
{% endif %}
{% if s.body and s.body is not none %}
{% set checks = checks + ',<br>' + lang.smon_page.desc.body_status_check + ':' + s.body %}
{% endif %}
{% if s.ssl_expire_date %}
{% set checks = checks + ',<br> SSL ' + lang.words.expire + ': ' + s.ssl_expire_date %}
{% endif %}
{% if s.group %}
{% if s.group not in group %}
<div class="smon_group">
<div class="group_name">
{{ s.group }}
</div>
</div>
{% endif %}
{% if group.append(s.group) %} {% endif %}
{% else %}
<div class="smon_group">
<div class="group_name">
None
</div>
</div>
{% endif %}
{% if s.en == 1 %}
{% if s.status == 1 and s.http_status == 1 and s.body_status == 1 %}
<div class="smon_services good div-server-head-up"
{% else %}
<div class="smon_services err div-server-head-down"
{% endif %}
{% else %}
<div class="smon_services dis div-server-head-dis"
{% endif %}
data-help="{{checks}}"
title="{{checks}}">
<div class="ip">
{% if s.ip|string|length > 23 %}
<span style="font-size: 11px;">
{% elif s.ip|string|length > 20 %}
<span style="font-size: 12px;">
{% elif s.ip|string|length > 17 %}
<span style="font-size: 15px;">
{% else %}
<span>
{% endif %}
<a href="smon.py?action=history&host={{s.ip}}" title="{{lang.words.view|title()}} {{lang.words.history}} {{lang.words.for}} {{s.ip}} {{lang.words.host}}" class="link">{{s.ip}}:{{s.port}}</a>
</span>
</span>
</div>
<div class="desc">
{% if s.desc is not none %}
<b>{{s.desc}}</b>
{% else %}
{{lang.words.desc|title()}}: None
{% endif %}
</div>
<div class="desc">
{% if s.en == 1 %}
{% if s.status == 1 and s.http_status == 1 and s.body_status == 1 %}
{{lang.words.uptime}}: <time class="timeago" datetime="{{s.time_state}}">{{s.time_state}}</time>
{% elif s.status == 0 or s.http_status == 0 or s.body_status == 0 %}
{{lang.words.downtime}}: <time class="timeago" datetime="{{s.time_state}}">{{s.time_state}}</time>
{% else %}
{{lang.words.uptime}}: N/A
{% endif %}
{% else %}
{{lang.words.uptime}}: N/A
{% endif %}
</div>
<div class="res_time">
{% if s.en == 1 %}
{% if s.status == 1 %}
{{lang.smon_page.desc.resp_time}}:
{% else %}
{{lang.smon_page.desc.last_resp_time}}:
{% endif %}
{% if s.response_time %}
<span title="{{s.response_time}} ms">{{s.response_time|truncate(9)}} ms</span>
{% else %}
N/A
{% endif %}
{% else %}
N/A
{% endif %}
</div>
{% if s.en == 1 %}
{% if s.status == 1 and s.http_status == 1 and s.body_status == 1 %}
<div class="up">
<center>
{{lang.smon_page.desc.UP}}
</center>
</div>
{% elif s.http_status == 0 %}
<div class="down">
<center style="padding-top: 7px;">
{{lang.smon_page.desc.HTTP_FAILURE}}
</center>
</div>
{% elif s.body_status == 0 %}
<div class="down">
<center style="padding-top: 7px;">
{{lang.smon_page.desc.BODY_FAILURE}}
</center>
</div>
{% elif s.status == 3 %}
<div class="unknown">
<center style="padding-top: 7px;">
{{lang.smon_page.desc.UNKNOWN}}
</center>
</div>
{% else %}
<div class="down">
<center style="padding-top: 7px;">
{{lang.smon_page.desc.PORT_DOWN}}
</center>
</div>
{% endif %}
{% else %}
<div class="disable">
<center>
{{lang.smon_page.desc.DISABLED}}
</center>
</div>
{% endif %}
</div>
{% endfor %}
<script>
jQuery(document).ready(function() {
jQuery("time.timeago").timeago();
})
{% if sort == 'by_status' %}
sort_by_status();
{% endif %}
</script>