2018-08-03 19:17:03 +00:00
|
|
|
{% extends "base.html" %}
|
2021-07-23 06:09:44 +00:00
|
|
|
{% from 'include/input_macros.html' import checkbox %}
|
2020-09-26 17:37:14 +00:00
|
|
|
{% block content %}
|
2018-08-03 19:17:03 +00:00
|
|
|
<style>
|
2021-06-08 07:37:42 +00:00
|
|
|
table, th, tr, td {
|
|
|
|
border: 1px solid #ddd;
|
|
|
|
align: center;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
th, tr, td {
|
|
|
|
width: 6%;
|
|
|
|
min-width: 3%;
|
|
|
|
padding: 10px;
|
2019-10-05 20:41:07 +00:00
|
|
|
}
|
2018-08-03 19:17:03 +00:00
|
|
|
</style>
|
2019-10-05 21:30:16 +00:00
|
|
|
<link href="/inc/chart.min.css" rel="stylesheet">
|
2019-10-05 20:41:07 +00:00
|
|
|
<script src="/inc/metrics.js"></script>
|
2019-10-05 21:30:16 +00:00
|
|
|
<script src="/inc/chart.min.js"></script>
|
2022-05-02 20:50:33 +00:00
|
|
|
{% if user_status == 0 %}
|
2022-04-29 10:28:48 +00:00
|
|
|
{% include 'include/no_sub.html' %}
|
|
|
|
{% elif services == '0' %}
|
2021-06-08 07:37:42 +00:00
|
|
|
<div style="text-align: center;">
|
2020-09-26 18:28:53 +00:00
|
|
|
<br />
|
2021-08-24 10:12:52 +00:00
|
|
|
<h3>You have not installed Metrics service.
|
2021-07-23 06:09:44 +00:00
|
|
|
Read <a href="https://roxy-wi.org/services.py?service=metrics#installation" title="Metrics installation" style="color: #5d9ceb;" target="_blank">hear</a>
|
2020-09-26 18:28:53 +00:00
|
|
|
how to install Metrics service</h3>
|
2021-06-08 07:37:42 +00:00
|
|
|
</div>
|
2020-09-26 17:37:14 +00:00
|
|
|
{% else %}
|
2020-05-07 15:25:32 +00:00
|
|
|
{% if servers|length == 0 %}
|
|
|
|
{% include 'include/getstarted.html' %}
|
|
|
|
{% else %}
|
2021-08-15 09:02:12 +00:00
|
|
|
{% if service != 'nginx' %}
|
2020-12-04 03:51:31 +00:00
|
|
|
<table style="min-width: 40%;">
|
|
|
|
<tr class="overviewHead">
|
|
|
|
<th colspan=13 style="background-color: #d1ecf1">
|
|
|
|
<span id="table_metrics_head" style="position: absolute;margin-left: 43%;">Metrics</span>
|
2021-06-08 07:37:42 +00:00
|
|
|
<span id="en_table_metric" class="plus switcher_table_metric" title="Enable display of the table of averages"></span>
|
|
|
|
<span id="dis_table_metric" class="minus switcher_table_metric" title="Disable display of the table of averages"></span>
|
2020-12-04 03:51:31 +00:00
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2020-05-07 15:25:32 +00:00
|
|
|
<div id="table_metrics"></div>
|
2021-08-15 09:02:12 +00:00
|
|
|
{% endif %}
|
2020-11-02 17:01:08 +00:00
|
|
|
<div style="padding-left: 25px;float: left;margin-top: 6px;">
|
|
|
|
<b>Time range:</b>
|
|
|
|
<select title="Choose time range" id="time-range">
|
|
|
|
<option value="30">30 minutes</option>
|
|
|
|
<option value="60">1 hour</option>
|
|
|
|
<option value="180">3 hours</option>
|
|
|
|
<option value="360">6 hours</option>
|
|
|
|
<option value="720">12 hours</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2021-08-15 09:02:12 +00:00
|
|
|
{% if service != 'nginx' %}
|
2021-07-23 06:09:44 +00:00
|
|
|
<div style="margin-top: 6px;">
|
|
|
|
{{ checkbox('hide_http_metrics', desc='Hide HTTP metrics', title='Hide HTTP metrics') }}
|
|
|
|
</div>
|
2021-08-15 09:02:12 +00:00
|
|
|
{% endif %}
|
2020-05-07 15:25:32 +00:00
|
|
|
<div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 10px;" title="Refresh metrics" onclick="showMetrics()">
|
2022-04-27 18:10:26 +00:00
|
|
|
<span class="refresh"></span>
|
2020-05-07 15:25:32 +00:00
|
|
|
</div>
|
2019-10-05 20:41:07 +00:00
|
|
|
{% for s in servers %}
|
2021-08-15 09:02:12 +00:00
|
|
|
{% if service != 'nginx' %}
|
2020-05-07 15:25:32 +00:00
|
|
|
<div class="chart-container">
|
2021-08-03 06:30:47 +00:00
|
|
|
<canvas id="{{s.ip}}" role="img"></canvas>
|
2020-05-07 15:25:32 +00:00
|
|
|
</div>
|
2021-08-03 06:30:47 +00:00
|
|
|
<div class="chart-container http_metrics_div" style="display: none">
|
|
|
|
<canvas id="http_{{s.ip}}" role="img"></canvas>
|
2021-06-08 07:37:42 +00:00
|
|
|
</div>
|
2021-08-15 09:02:12 +00:00
|
|
|
{% else %}
|
2021-08-16 09:22:30 +00:00
|
|
|
<div class="chart-container">
|
2021-08-15 09:02:12 +00:00
|
|
|
<canvas id="nginx_{{s.ip}}" role="img"></canvas>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2019-10-05 20:41:07 +00:00
|
|
|
{% endfor %}
|
2018-08-06 16:18:12 +00:00
|
|
|
<script>
|
2020-06-01 16:13:28 +00:00
|
|
|
function showMetrics() {
|
|
|
|
let metrics = new Promise(
|
|
|
|
(resolve, reject) => {
|
2021-06-08 07:37:42 +00:00
|
|
|
removeData();
|
2020-06-01 16:13:28 +00:00
|
|
|
{% for s in servers %}
|
2021-08-15 09:02:12 +00:00
|
|
|
{% if service != 'nginx' %}
|
2021-08-03 06:30:47 +00:00
|
|
|
getChartData('{{s.ip}}')
|
|
|
|
getHttpChartData('{{s.ip}}')
|
2021-08-15 09:02:12 +00:00
|
|
|
{% else %}
|
|
|
|
getNginxChartData('{{s.ip}}')
|
|
|
|
{% endif %}
|
2020-06-01 16:13:28 +00:00
|
|
|
{% endfor %}
|
2021-08-15 09:02:12 +00:00
|
|
|
{% if service != 'nginx' %}
|
2020-12-04 03:51:31 +00:00
|
|
|
if (localStorage.getItem('table_metrics') == 0 || localStorage.getItem('table_metrics') === null) {
|
|
|
|
$('#dis_table_metric').css('display', 'none');
|
|
|
|
} else {
|
|
|
|
$('#en_table_metric').css('display', 'none');
|
|
|
|
loadMetrics();
|
|
|
|
}
|
2021-08-15 09:02:12 +00:00
|
|
|
{% endif %}
|
2020-06-01 16:13:28 +00:00
|
|
|
});
|
|
|
|
metrics.then();
|
|
|
|
}
|
|
|
|
showMetrics()
|
2020-11-02 17:01:08 +00:00
|
|
|
$( function() {
|
|
|
|
$("#time-range").on('selectmenuchange', function () {
|
|
|
|
removeData()
|
|
|
|
let metrics = new Promise(
|
|
|
|
(resolve, reject) => {
|
|
|
|
{% for s in servers %}
|
2021-08-15 09:02:12 +00:00
|
|
|
{% if service != 'nginx' %}
|
2021-08-03 06:30:47 +00:00
|
|
|
getChartData('{{s.ip}}')
|
|
|
|
getHttpChartData('{{s.ip}}')
|
2021-08-15 09:02:12 +00:00
|
|
|
{% else %}
|
|
|
|
getNginxChartData('{{s.ip}}')
|
|
|
|
{% endif %}
|
2020-11-02 17:01:08 +00:00
|
|
|
{% endfor %}
|
|
|
|
});
|
|
|
|
metrics.then();
|
|
|
|
});
|
|
|
|
});
|
2020-12-04 03:51:31 +00:00
|
|
|
|
2018-08-03 19:17:03 +00:00
|
|
|
</script>
|
2020-05-07 15:25:32 +00:00
|
|
|
{% endif %}
|
2020-09-26 17:37:14 +00:00
|
|
|
{% endif %}
|
2020-05-07 15:25:32 +00:00
|
|
|
{% endblock %}
|