You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/app/templates/ovw.html

453 lines
15 KiB

{% extends "base.html" %}
{% block content %}
<link href="/inc/chart.min.css" rel="stylesheet">
<script src="/inc/metrics.js"></script>
<script src="/inc/chart.min.js"></script>
<script src="/inc/overview.js"></script>
<script>
$("#secIntervals").css("display", "none");
var ip = []
var hostnamea = []
{% for s in servers %}
ip.push("{{s[2]}}")
var host = "{{s[2]}}"
host = host.replace(/\./g, '\\.');
host = host.replace(/ /g, '');
hostnamea.push(host)
{% endfor %}
</script>
<style>
.fa-sync-alt { margin-bottom: -1px; }
</style>
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">
{% if role <= 2 %}
<a href="servers.py#servers" title="Manage servers">Servers</a>
{% else %}
Server
{% endif %}
</td>
<td class="padding10 third-collumn-wi" style="width: 20%;">
<a href="/app/hapservers.py" title="HAProxy servers overview" class="logs_link">
HAProxy
</a>
</td>
<td class="padding10">
<a href="/app/hapservers.py?service=nginx" title="NGINX servers overview" class="logs_link">
NGINX
</a>
</td>
<td class="padding10">
<a href="/app/hapservers.py?service=apache" title="Apache servers overview" class="logs_link">
Apache
</a>
</td>
<td class="padding10">
<a href="/app/hapservers.py?service=keepalived" title="Keepalived servers overview" class="logs_link">
Keepalived
</a>
</td>
<td class="padding10">
<a href="/app/waf.py" title="WAf servers overview" class="logs_link">
WAF
</a>
</td>
<td class="padding10">
<a onclick="showOverview(ip, hostnamea)" title="Refresh" style="float: right;">
<span class="refresh"></span>
</a>
</td>
</tr>
{% for s in servers %}
<tr class="{{ loop.cycle('odd', 'even') }}" id="{{s[2]}}"></tr>
{% endfor %}
</table>
<table class="overview-wi">
<tr class="overviewHead" style="height: 30px;">
<td class="padding10 first-collumn-wi" colspan="2">
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{haproxy_wi_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View Roxy-WI logs" class="logs_link">
Roxy-WI server status
</a>
{% else %}
Roxy-WI server status
{% endif %}
</td>
<td>
<a onclick="showOverviewHapWI()" title="Refresh" style="float: right; margin-right: 15px;">
<span class="refresh"></span>
</a>
</td>
</tr>
<tr>
<td style="width:100%" colspan="3">
<div id="cpu_div" style="height: 140px;width: 50%;float: left; margin:0; padding:0;">
<canvas id="cpu" role="img"></canvas>
</div>
<div id="ram_div" style="height: 140px;width: 50%;float: right;margin:0; padding:0;">
<canvas id="ram" role="img"></canvas>
</div>
</td>
</tr>
</table>
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi" colspan=4>
{% if role <= 1 %}
<a href="/app/users.py#services" title="View services status" class="logs_link">
Services status
</a>
{% else %}
Services status
{% endif %}
</td>
</tr>
<tr class="odd">
<td class="padding10 first-collumn-wi">
{% if metrics_master == 'active' %}
<span class="serverUp server-status" title="running {{ metrics_master }} master processes"></span>
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{metrics_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View metrics master's logs" class="logs_link">
Metrics master
</a>
{% else %}
Metrics master
{% endif %}
{% else %}
{% if metrics_master == 'inactive' or metrics_master == 'failed' %}
<span class="serverDown server-status" title="Metrics is stopped"></span>
{% if role <= 1 %}
<a href="/app/users.py#services" title="Start Metrics - Roxy-WI service" class="logs_link">
Metrics master
</a>
{% else %}
Metrics master
{% endif %}
{% else %}
<span class="serverNone server-status" title="Metrics is not installed"></span>
<a href="https://roxy-wi.org/services.py?service=metrics#installation" title="Metrics installation" target="_blank" class="logs_link">
Metrics master
</a>
{% endif %}
{% endif %}
</td>
<td class="third-collumn-wi">
{% if checker_master == 'active' %}
<span class="serverUp server-status" title="running {{ checker_master }} master processes"></span>
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{checker_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker master's logs" class="logs_link">
Checker master
</a>
{% else %}
Checker master
{% endif %}
{% else %}
{% if checker_master == 'inactive' or checker_master == 'failed' %}
<span class="serverDown server-status" title="Checker is stopped"></span>
{% if role <= 1 %}
<a href="/app/users.py#services" title="Start Checker - Roxy-WI service" class="logs_link">
Checker master
</a>
{% else %}
Checker master
{% endif %}
{% else %}
<span class="serverNone server-status" title="Backends checker is not installed"></span>
<a href="https://roxy-wi.org/services.py?service=checker#installation" title="Backends checker installation" target="_blank" class="logs_link">
Checker master
</a>
{% endif %}
{% endif %}
</td>
<td class="third-collumn-wi">
{% if keep_alive == 'active' %}
<span class="serverUp server-status" title="running {{ keep_alive }} processe"></span>
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{keep_alive_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View Auto start logs" class="logs_link">
Auto start
</a>
{% else %}
Auto star
{% endif %}
{% else %}
{% if keep_alive == 'inactive' or keep_alive == 'failed' %}
<span class="serverDown server-status" title="Auto start is stopped"></span>
{% if role <= 1 %}
<a href="/app/users.py#services" title="Start Auto star - Roxy-WI service" class="logs_link">
Auto start
</a>
{% else %}
Auto start
{% endif %}
{% else %}
<span class="serverNone server-status" title="Auto start is not installed"></span>
<a href="https://roxy-wi.org/services.py?service=auto_start#installation" title="Auto start installation" target="_blank" class="logs_link">
Auto start
</a>
{% endif %}
{% endif %}
</td>
</tr>
<tr class="even">
<td class="padding10 first-collumn-wi">
{% if metrics_worker|int() >= 1 %}
<span class="serverUp server-status" title="running {{metrics_worker}} worker processes"></span>
{% else %}
{% if is_metrics_worker|int() == 0 %}
<span class="serverNone server-status" title="There is not job for metrics"></span>
{% else %}
<span class="serverDown server-status" title="running {{is_checker_worker}} worker processes"></span>
{% endif %}
{% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{metrics_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View worker's logs" class="logs_link">
Metrics workers
</a>
{% else %}
Metrics workers
{% endif %}
</td>
<td>
{% if checker_worker|int() >= 1 %}
<span class="serverUp server-status" title="running {{ checker_worker }} worker processes"></span>
{% else %}
{% if is_checker_worker|int() == 0 %}
<span class="serverNone server-status" title="There is not job for checker"></span>
{% else %}
<span class="serverDown server-status" title="running {{ checker_worker }} worker processes"></span>
{% endif %}
{% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{checker_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker's logs" class="logs_link">
Checker workers
</a>
{% else %}
Checker workers
{% endif %}
</td>
<td>
{% if smon == 'active' %}
<span class="serverUp server-status" title="SMON is started"></span>
<a href="/app/smon.py?action=view" title="SMON Dashboard" class="logs_link">
SMON
</a>
{% else %}
{% if smon == 'inactive' or smon == 'failed' %}
<span class="serverDown server-status" title="SMON is stopped"></span>
<a href="/app/users.py#services" title="Start SMON - Roxy-WI service" class="logs_link">
SMON
</a>
{% else %}
<span title="SMON is not installed"><span class="serverNone server-status"></span></span>
<a href="https://roxy-wi.org/services.py?service=smon" title="Simple monitoring ports installation" target="_blank" class="logs_link">
SMON
</a>
{% endif %}
{% endif %}
</td>
</tr>
<tr class="odd">
{% if role == 1 %}
<td class="padding10 first-collumn-wi">
{% if grafana|int() >= 1 %}
<span class="serverUp server-status" title="running {{grafana}} process"></span>
<a href="http://{{host}}:3000" target="_blank" title="Open Grafana" class="logs_link">Grafana</a>
{% else %}
<span class="serverNone server-status" title="The service is not installed or not running"></span>
<span>Grafana</span>
{% endif %}
{% endif %}
</td>
<td {% if role != 1 %}class="padding10 first-collumn-wi"{%endif%}>
{% if socket == 'active' %}
<span class="serverUp server-status" title="Socket service is started"></span>
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs={{socket_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View Socket's logs" class="logs_link">
Socket service
</a>
{% else %}
Socket service
{% endif %}
{% else %}
{% if socket == 'inactive' or socket == 'failed' %}
<span class="serverDown server-status" title="Socket service scanner is stopped"></span>
<a href="/app/users.py#services" title="Socket service - Roxy-WI service" class="logs_link">
Socket service
</a>
{% else %}
<span title="Socket service is not installed"><span class="serverNone server-status"></span></span>
<a href="https://roxy-wi.org/services.py?service=socket" title="Socket service" target="_blank" class="logs_link">
Socket service
</a>
{% endif %}
{% endif %}
</td>
<td>
{% if port_scanner == 'active' %}
<span class="serverUp server-status" title="Port scanner is started"></span>
<a href="/app/portscanner.py" title="Port scanner Dashboard" class="logs_link">
Port scanner
</a>
{% else %}
{% if port_scanner == 'inactive' or port_scanner == 'failed' %}
<span class="serverDown server-status" title="Port scanner is stopped"></span>
<a href="/app/users.py#services" title="Start Port scanner - Roxy-WI service" class="logs_link">
Port scanner
</a>
{% else %}
<span title="Port scanner is not installed"><span class="serverNone server-status"></span></span>
<a href="https://roxy-wi.org/services.py?service=port_scanner" title="Port scanner" target="_blank" class="logs_link">
Port scanner
</a>
{% endif %}
{% endif %}
</td>
</tr>
</table>
{% if role <= 2 %}
{% if role == 2 %}
{% set admin_uri = 'servers.py' %}
{% elif role == 1 %}
{% set admin_uri = 'users.py' %}
{% endif %}
<table class="overview-wi">
<thead>
<tr class="overviewHead" style="height: 30px;">
<td class="padding10 first-collumn-wi">
<a href="{{admin_uri}}#users" title="Manage users" class="logs_link">Login</a>
</td>
<td class="second-collumn">Groups</td>
<td>Role</td>
<td>
<span class="add-button-wi">
<span title="Show all users" id="show-all-users" style="color: #fff">
Show all
</span>
</span>
</td>
<td style="padding-right: 10px;">
<a onclick="showUsersOverview()" title="Refresh" style="float: right;">
<span class="refresh"></span>
</a>
</td>
</tr>
</thead>
<tbody id="users-table"></tbody>
</table>
{% endif %}
{% if role <= 1 %}
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">
<a href="users.py#groups" title="Manage groups" class="logs_link">Group</a>
</td>
<td class="second-collumn" style="width: 40%">Description</td>
<td>
<span class="add-button-wi">
<span title="Show all groups" id="show-all-groups" style="color: #fff">
Show all
</span>
</span>
</td>
</tr>
{% set counter = 0 -%}
{% for group in groups %}
{% set counter = counter + loop.index0 %}
{% if counter <= 2 %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
{{ group.name }}
</td>
<td class="third-collumn-wi" colspan="2">{{ group.description }}</td>
</tr>
{% else %}
<tr style="display: none;" class="show-groups {{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
{{ group.name }}
</td>
<td class="third-collumn-wi" colspan="2">{{ group.description }}</td>
</tr>
{% endif %}
{% endfor %}
</table>
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">Role</td>
<td class="second-collumn" style="width: 50%">Description</td>
<td></td>
<td></td>
</tr>
{% for role in roles %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi">
{{ role.name }}
</td>
<td class="third-collumn-wi">{{ role.description }}</td>
<td></td>
<td></td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if role <= 2 %}
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">
{% if role == 2 %}
<a href="/app/viewlogs.py?type=2&viewlogs={{haproxy_wi_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View Roxy-WI logs" class="logs_link">
{% else %}
<a href="/app/viewlogs.py?viewlogs={{haproxy_wi_log_id}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View Roxy-WI logs" class="logs_link">
{% endif %}
Recent Roxy-WI log
</a>
</td>
<td>
<span class="add-button-wi">
<span title="Show more log" id="show-all-haproxy-wi-log" style="color: #fff">
Show more log
</span>
</span>
</td>
</tr>
<tr>
{% set counter = 0 -%}
{% for log in haproxy_wi_log %}
{% set counter = counter + loop.index0 %}
{% if counter <= 2 %}
<tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi" style="font-size: 12.5px;" colspan="2">
{{log }}
</td>
</tr>
{% else %}
<tr style="display: none;" class="show-haproxy-wi-log" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn-wi" style="font-size: 12.5px" colspan="2">
{{log }}
</td>
</tr>
{% endif %}
{% endfor %}
</tr>
</table>
{% endif %}
{% if role <= 1 %}
<table class="overview-wi">
<tr class="overviewHead" style="height: 30px;">
<td class="padding10 first-collumn-wi" colspan="2">
<a href="https://roxy-wi.org/cabinet.py" title="Personal cabinet" class="logs_link" target="_blank">Subscription</a>
</td>
</tr>
<tbody id="sub-table"></tbody>
</table>
{% endif %}
<div id="dialog-confirm" style="display: none;">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
</div>
<script>
showOverview(ip, hostnamea)
</script>
{% endblock %}