2019-09-22 15:46:26 +00:00
{% extends "base.html" %}
{% block content %}
2020-02-02 14:23:00 +00:00
{% from 'include/input_macros.html' import input, checkbox, select %}
2019-12-27 04:31:09 +00:00
< script src = "/inc/overview.js" > < / script >
2019-10-25 07:18:57 +00:00
{% if serv %}
< style >
@media (max-width: 1280px) {
.div-pannel {
height: 430px !important;
}
}
< / style >
{% endif %}
2019-12-27 04:31:09 +00:00
< style >
.alert-danger {
width: 250px;
2019-12-30 15:52:01 +00:00
display: inline-block;
height: 15px;
padding-top: 0px;
padding-bottom: 8px;
2019-12-27 04:31:09 +00:00
margin-bottom: -20px !important;
}
< / style >
2019-12-30 15:52:01 +00:00
< script >
var ip = []
var hostnamea = []
{% for s in servers %}
ip.push("{{s[2]}}")
2020-03-19 13:11:35 +00:00
var host = "{{s[1]}}"
host = host.replace(/\./g, '\\.');
hostnamea.push(host)
2019-12-30 15:52:01 +00:00
{% endfor %}
2020-06-01 16:13:28 +00:00
$( function() {
$( ".sortable" ).sortable({
revert: true,
placeholder: "ui-state-highlight"
});
$( ".sortable" ).disableSelection();
$( ".sortable" ).sortable({
stop: function(event, ui) {
var itemOrder = $('.sortable').sortable("toArray");
for (var i = 0; i < itemOrder.length ; i + + ) {
var pos = i;
var id = itemOrder[i].split('-')[2]
change_pos(pos, id);
}
}
});
2020-09-26 17:37:14 +00:00
{% for s in services %}
{% if s.1 == '* is not installed' %}
{% if s.0 == 'checker_haproxy' %}
$(':regex(id, alert)').checkboxradio('disable');
{% elif s.0 == 'keep_alive' %}
$(':regex(id, active-)').checkboxradio('disable');
{% elif s.0 == 'metrics_haproxy' %}
$(':regex(id, metrics-)').checkboxradio('disable');
{% endif %}
{% endif %}
{% endfor %}
2020-06-01 16:13:28 +00:00
});
2019-12-30 15:52:01 +00:00
< / script >
2020-08-02 08:39:54 +00:00
{% if serv %}
< div id = "up-pannel" >
{% else %}
< div id = "up-pannel" class = "sortable" >
{% endif %}
2020-05-07 15:25:32 +00:00
{% if servers|length == 0 %}
{% include 'include/getstarted.html' %}
{% endif %}
2019-09-22 18:16:39 +00:00
{% for s in servers %}
2020-02-02 14:23:00 +00:00
{% if serv %}
< link href = "/inc/chart.min.css" rel = "stylesheet" >
< script src = "/inc/metrics.js" > < / script >
< script src = "/inc/chart.min.js" > < / script >
< script >
function showMetrics() {
2020-03-17 18:20:59 +00:00
{% if service == 'haproxy' %}
{% for s in servers %}
getChartData('{{s.2}}')
getWafChartData('{{s.2}}')
{% endfor %}
{% endif %}
2020-04-21 21:07:54 +00:00
showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}', '{{service}}');
2020-08-02 08:39:54 +00:00
showBytes('{{ s.2 }}')
2020-02-02 14:23:00 +00:00
}
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 %}
getChartData('{{s.2}}')
getWafChartData('{{s.2}}')
{% endfor %}
});
metrics.then();
});
});
2020-02-02 14:23:00 +00:00
< / script >
{% endif %}
2020-11-02 17:01:08 +00:00
{% if service == 'nginx' %}
2020-11-13 05:15:27 +00:00
{% set checker_desc = 'Checker monitors Nginx services. If Nginx service is down, Checker will alert via Telegram' %}
2020-11-02 17:01:08 +00:00
{% if s.5.0.3 == 'active' %}
{% set additional_status_class = 'div-server-head-up' %}
{% else %}
{% set additional_status_class = 'div-server-head-down' %}
{% endif %}
{% else %}
2020-11-13 05:15:27 +00:00
{% set checker_desc = 'Checker monitors HAProxy services and its backends. If some backend or HAProxy service is down, Checker will alert via Telegram' %}
2020-11-02 17:01:08 +00:00
{% if s.5 != False %}
{% set additional_status_class = 'div-server-head-up' %}
{% else %}
{% set additional_status_class = 'div-server-head-down' %}
{% endif %}
{% endif %}
< div id = "div-server-{{s.0}}" class = "div-server-hapwi {{additional_status_class}}" { % if not serv % } style = "cursor: move;" { % endif % } >
2020-09-26 17:37:14 +00:00
< div class = "server-name" >
2020-04-21 21:07:54 +00:00
< input type = "hidden" id = "server-name-{{s.0}}" value = "{{s.1}}" / >
< input type = "hidden" id = "service" value = "{{service}}" / >
2020-02-05 08:15:57 +00:00
{% if service == 'nginx' %}
{% if s.5.0.3 == 'active' %}
< span class = "serverUp server-status" title = "Uptime: {{s.5.0.4}}" > < / span >
{% else %}
< span class = "serverDown server-status" title = "Downtime: : {{s.5.0.4}}" > < / span >
2020-11-02 17:01:08 +00:00
{% endif %}
2020-02-05 08:15:57 +00:00
{% else %}
{% if s.5 != False %}
< span class = "serverUp server-status" title = "{{s.5.0.2}}" > < / span >
{% else %}
< span class = "serverDown server-status" title = "HAProxy is down" > < / span >
{% endif %}
2020-04-21 21:07:54 +00:00
{% endif %}
{% if not serv %}
< a href = "/app/hapservers.py?service={{service}}&serv={{s.2}}" title = "More about {{s.1}}" style = "color: #5d9ceb" > {{s.1}}< / a >
2020-02-05 08:15:57 +00:00
{% else %}
{{s.1}}
{% endif %}
{% if service == 'haproxy' %}
{% if s.6|int() >= 1 %}
< img
{% if keep_alive|int() >= 1 %}
src="/inc/images/shield.png" title="Auto start enabled"
{% else %}
src="/inc/images/shield-red.png" title="Auto start enabled, but keep alive service does not work"
{% endif %}
width=18 style="padding-left: 5px; margin-bottom: -3px;">
{% endif %}
2019-10-14 06:55:29 +00:00
{% endif %}
2020-08-08 20:54:53 +00:00
{% if role < = 2 %}
2019-09-22 18:16:39 +00:00
< span class = "server-action" >
2020-02-05 08:15:57 +00:00
{% if service == 'nginx' %}
{% set action_service = 'nginx' %}
{% else %}
{% set action_service = 'hap' %}
{% endif %}
2020-06-10 06:34:56 +00:00
< a id = "start-{{ s.2 }}" class = "start" title = "Start {{service}} service" >
2020-02-08 16:29:46 +00:00
< span class = "service-start" onclick = "confirmAjaxAction('start', '{{action_service}}', '{{s.2}}')" > < / span >
2019-09-22 18:16:39 +00:00
< / a >
2020-06-10 06:34:56 +00:00
< a id = "reload-{{ s.2 }}" class = "reload" title = "Reload {{service}} service" >
2020-05-11 16:41:54 +00:00
< span class = "service-reload" onclick = "confirmAjaxAction('reload', '{{action_service}}', '{{s.2}}', '{{s.1}}')" > < / span >
2019-09-22 18:16:39 +00:00
< / a >
2020-06-10 06:34:56 +00:00
< a id = "restart-{{ s.2 }}" class = "restart" title = "Restart {{service}} service" >
2020-05-11 16:41:54 +00:00
< span class = "service-reload service-restart" onclick = "confirmAjaxAction('restart', '{{action_service}}', '{{s.2}}')" > < / span >
< / a >
< a id = "stop-{{ s.2 }}" class = "stop" title = "Stop {{service}} service" >
< span class = "service-stop" onclick = "confirmAjaxAction('stop', '{{action_service}}', '{{s.2}}')" > < / span >
2019-09-22 18:16:39 +00:00
< / a >
< / span >
{% endif %}
< / div >
2020-08-02 08:39:54 +00:00
{% if service == 'nginx' %}
< div class = "server-desc" style = "height: 110px;" >
{% else %}
< div class = "server-desc" >
{% endif %}
2019-09-22 18:16:39 +00:00
{{s.3}}
2019-12-30 15:52:01 +00:00
< br / >
2020-02-05 08:15:57 +00:00
{% if service == 'nginx' %}
2020-08-02 08:39:54 +00:00
Version: {{s.5.0.2}} Process_num: {{s.5.0.5}} {% if s.5.0.3 == 'active' %}
< br / >
Uptime: {% else %} Downtime: {% endif %} {{s.5.0.4}}
2019-12-30 15:52:01 +00:00
{% else %}
2020-02-05 08:15:57 +00:00
{% if s.5.0 is defined %}
{{s.5.0.0}} {{s.5.0.1}} {{s.5.0.2}}
{% else %}
Cannot get information about HAProxy
{% endif %}
2019-10-14 06:55:29 +00:00
{% endif %}
2019-09-22 18:16:39 +00:00
< br / >
2019-12-27 04:31:09 +00:00
< span title = "Date of last edit config" >
Last edit:
< span id = "{{s.1}}" > < / span >
2019-10-14 06:55:29 +00:00
< / span >
2019-09-26 15:48:56 +00:00
< br / >
IP: {{s.2}}
2020-01-23 05:55:12 +00:00
{% if s.7.0.0 != None %}
Master for: {{ s.7.0.1 }}
{% endif %}
2019-09-22 18:16:39 +00:00
< / div >
2020-02-05 08:15:57 +00:00
{% if service == 'haproxy' %}
< div class = "server-act-links" id = "server-{{s.8.0.0|string()}}" >
2020-08-08 20:54:53 +00:00
{% if role < = 2 %}
2020-02-05 08:15:57 +00:00
{% set id = 'alert-' + s.8.0.0|string() %}
{% if s.8.0.8 == 1 %}
2020-11-13 05:15:27 +00:00
{{ checkbox(id, title=checker_desc, value='1', desc='Checker', checked='checked') }}
2020-02-05 08:15:57 +00:00
{% else %}
2020-11-13 05:15:27 +00:00
{{ checkbox(id, title=checker_desc, value='1', desc='Checker') }}
2020-02-05 08:15:57 +00:00
{% endif %}
{% set id = 'metrics-' + s.8.0.0|string() %}
{% if s.8.0.9 == 1 %}
2020-11-13 05:15:27 +00:00
{{ checkbox(id, title='Collecting metrics is enabled', value='1', desc='Metrics', checked='checked') }}
2020-02-05 08:15:57 +00:00
{% else %}
2020-11-13 05:15:27 +00:00
{{ checkbox(id, title='Enable collecting metrics', value='1', desc='Metrics') }}
2020-02-05 08:15:57 +00:00
{% endif %}
{% set id = 'active-' + s.8.0.0|string() %}
{% if s.8.0.12 == 1 %}
2020-11-13 05:15:27 +00:00
{{ checkbox(id, title='Auto Start is enabled', value='1', desc='Auto Start', checked='checked') }}
2020-02-05 08:15:57 +00:00
{% else %}
{{ checkbox(id, title='Enable Auto Start', value='1', desc='Auto Start') }}
{% endif %}
{% endif %}
< / div >
{% endif %}
2019-09-22 18:16:39 +00:00
< div class = "server-act-links" >
2020-03-27 21:16:04 +00:00
< a href = "/app/config.py?service={{service}}&serv={{s.2}}&showConfig" class = "ui-button ui-widget ui-corner-all" title = "Open running config" > Open< / a >
2020-02-05 08:15:57 +00:00
< a href = "/app/config.py?service={{service}}&serv={{s.2}}&showCompare" class = "ui-button ui-widget ui-corner-all" title = "Compare configs" > Compare< / a >
{% if service != 'nginx' %}
2020-03-17 18:20:59 +00:00
< a href = "/app/config.py?serv={{s.2}}&showMap" class = "ui-button ui-widget ui-corner-all" title = "Show map" > Map< / a >
2020-02-05 08:15:57 +00:00
{% endif %}
2020-03-17 18:20:59 +00:00
< a href = "/app/viewsttats.py?service={{service}}&serv={{s.2}}" class = "ui-button ui-widget ui-corner-all" title = "View stat" > Stat< / a >
< a href = "/app/logs.py?service={{service}}&serv={{s.2}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" class = "ui-button ui-widget ui-corner-all" title = "View log" > Log< / a >
2019-09-22 18:16:39 +00:00
{% if role < = 2 %}
2020-02-05 08:15:57 +00:00
< a href = "/app/versions.py?service={{service}}&serv={{s.2}}&open=open" class = "ui-button ui-widget ui-corner-all" > Versions< / a >
2019-09-22 18:16:39 +00:00
{% endif %}
< / div >
< / div >
2019-11-11 21:59:09 +00:00
{% if serv %}
2020-08-02 08:39:54 +00:00
{% if service == 'haproxy' %}
< div id = "bin_bout" > < / div >
{% endif %}
2020-04-21 21:07:54 +00:00
< div id = "ajax-server-{{s.0}}" class = "ajax-server" > < / div >
2020-08-02 08:39:54 +00:00
< div class = "div-server div-backends" >
< div class = "server-name backends" >
2020-04-21 21:07:54 +00:00
{% if service == 'haproxy' %}
Backends:
{% else %}
Virtual hosts:
{% endif %}
2020-08-02 08:39:54 +00:00
< / div >
2019-12-27 04:31:09 +00:00
< div style = "margin-top: 10px;" id = "top-{{s.1}}" > < / div >
2019-11-11 21:59:09 +00:00
< / div >
{% endif %}
2019-09-22 18:16:39 +00:00
{% endfor %}
2019-09-22 15:46:26 +00:00
< / div >
2020-03-17 18:20:59 +00:00
{% if serv and service == 'haproxy' %}
2020-11-02 17:01:08 +00:00
< div style = "clear: both; width: 95%;" >
< div style = "padding-left: 25px;float: left;margin-top: -15px;" >
< 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 >
< div id = "refresh" style = "text-align: right;margin-right: 3%;" title = "Refresh metrics" onclick = "showMetrics()" >
< span class = "service-reload" > < / span >
< / div >
2019-10-25 07:18:57 +00:00
< / div >
{% for s in servers %}
2020-08-02 08:39:54 +00:00
< div class = "chart-container" style = "display: block; width: 91.3%; height: 300px;" >
2019-10-25 07:18:57 +00:00
< canvas id = "{{s.2}}" role = "img" > < / canvas >
< / div >
2019-11-06 19:56:28 +00:00
< div class = "chart-container" style = "display: block; width: 90%; height: 300px;" >
2019-10-25 07:18:57 +00:00
< canvas id = "s_{{s.2}}" role = "img" > < / canvas >
< / div >
{% endfor %}
{% endif %}
2019-09-22 15:46:26 +00:00
< 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 >
2019-12-27 04:31:09 +00:00
< script >
2020-04-21 21:07:54 +00:00
{% if serv %}
overviewHapserverBackends(ip, hostnamea, '{{service}}');
2019-12-27 04:31:09 +00:00
{% endif %}
2020-02-05 08:15:57 +00:00
showHapservers(ip, hostnamea, '{{service}}');
2019-12-27 04:31:09 +00:00
< / script >
2020-04-21 21:07:54 +00:00
{% endblock %}