Changelog: https://roxy-wi.org/changelog#6_3_9
pull/364/head
Aidaho 2023-04-09 19:40:41 +03:00
parent 1ba2183618
commit 28547820b9
9 changed files with 74 additions and 22 deletions

View File

@ -151,9 +151,10 @@ def show_haproxy_binout(server_ip: str) -> None:
server_ip, port)
cout, stderr3 = server_mod.subprocess_execute(cmd)
bin_bout.append(cout[0])
lang = roxywi_common.get_user_lang()
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
template = env.get_template('ajax/bin_bout.html')
template = template.render(bin_bout=bin_bout, serv=server_ip, service='haproxy')
template = template.render(bin_bout=bin_bout, serv=server_ip, service='haproxy', lang=lang)
print(template)
@ -174,9 +175,10 @@ def show_nginx_connections(server_ip: str) -> None:
if num == 2:
bin_bout.append(line.split(' ')[3])
lang = roxywi_common.get_user_lang()
env = Environment(loader=FileSystemLoader('templates'))
template = env.get_template('ajax/bin_bout.html')
template = template.render(bin_bout=bin_bout, serv=server_ip, service='nginx')
template = template.render(bin_bout=bin_bout, serv=server_ip, service='nginx', lang=lang)
print(template)
else:
print('error: cannot connect to NGINX stat page')
@ -197,9 +199,10 @@ def show_apache_bytes(server_ip: str) -> None:
if 'ReqPerSec' in line or 'BytesPerSec' in line:
bin_bout.append(line.split(' ')[1])
lang = roxywi_common.get_user_lang()
env = Environment(loader=FileSystemLoader('templates'))
template = env.get_template('ajax/bin_bout.html')
template = template.render(bin_bout=bin_bout, serv=server_ip, service='apache')
template = template.render(bin_bout=bin_bout, serv=server_ip, service='apache', lang=lang)
print(template)
else:
print('error: cannot connect to Apache stat page')
@ -282,7 +285,8 @@ def show_services_overview() -> None:
def keepalived_became_master(server_ip) -> None:
commands = ["sudo kill -USR2 $(cat /var/run/keepalived.pid) && sudo grep 'Became master' /tmp/keepalived.stats |awk '{print $3}'"]
became_master = server_mod.ssh_command(server_ip, commands)
lang = roxywi_common.get_user_lang()
env = Environment(loader=FileSystemLoader('templates'))
template = env.get_template('ajax/bin_bout.html')
template = template.render(bin_bout=became_master, serv=server_ip, service='keepalived')
template = template.render(bin_bout=became_master, serv=server_ip, service='keepalived', lang=lang)
print(template)

View File

@ -71,7 +71,7 @@ def get_exp_version(server_ip: str, service_name: str) -> str:
return 'no'
def get_correct_apache_service_name(server_ip=None, server_id=0) -> str:
def get_correct_apache_service_name(server_ip=None, server_id=None) -> str:
if server_id is None:
server_id = sql.select_server_id_by_ip(server_ip)

View File

@ -1,12 +1,13 @@
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% if service == 'haproxy' %}
<div class="bin_bout" id="show_bin_bout">
<div class="server-name">
Bytes in
<span class="update-icon" style="font-size: 13px; margin-top: 8px;">
<a onclick="showBytes('{{ serv }}')" title="Refresh">
<div class="bin_bout_text overflow" title="{{lang.phrases.bytes_in}}">{{lang.phrases.bytes_in}}</div>
<div class="update-icon" style="font-size: 13px; margin-top: 5px;">
<a onclick="showBytes('{{ serv }}')" title="{{lang.words.refresh|title()}}">
<span class="service-reload"></span>
</a>
</span>
</div>
</div>
<div class="bytes" id="bin">
{% set total = bin_bout.0|int / 1024 %}
@ -22,7 +23,7 @@
{{total|round(2)}} {{metric}}
</div>
<div class="server-name">
Bytes Out
<div class="bin_bout_text bin_bout_text_without_refresh overflow" title="{{lang.phrases.bytes_out}}">{{lang.phrases.bytes_out}}</div>
</div>
<div class="bytes" id="bout">
{% set total = bin_bout.1|int / 1024 %}
@ -42,20 +43,20 @@
{% if service == 'nginx' or service == 'haproxy' %}
<div id="sessions" class="bin_bout">
<div class="server-name">
Current ses
<div class="bin_bout_text {%if service == 'haproxy'%}bin_bout_text_without_refresh{%endif%} overflow" title="{{lang.phrases.current_ses}}">{{lang.phrases.current_ses}}</div>
{% if service == 'nginx' %}
<span class="update-icon" style="font-size: 13px; margin-top: 8px;">
<div class="update-icon" style="font-size: 13px; margin-top: 8px;">
<a onclick="showNginxConnections('{{ serv }}')" title="Refresh">
<span class="service-reload"></span>
</a>
</span>
</div>
{% endif %}
</div>
<div class="bytes" id="cur_sess">
{{bin_bout.2}}
</div>
<div class="server-name">
Total ses
<div class="bin_bout_text bin_bout_text_without_refresh overflow" title="{{lang.phrases.total_ses}}">{{lang.phrases.total_ses}}</div>
</div>
<div class="bytes" id="total_sess">
{{bin_bout.3}}
@ -65,7 +66,7 @@
{% if service == 'apache' %}
<div class="bin_bout" id="show_bin_bout">
<div class="server-name">
ReqPerSec
<div class="bin_bout_text overflow" title="{{lang.phrases.ReqPerSec}}">{{lang.phrases.ReqPerSec}}</div>
<span class="update-icon" style="font-size: 13px; margin-top: 8px;">
<a onclick="showApachekBytes('{{ serv }}')" title="Refresh">
<span class="service-reload"></span>
@ -76,7 +77,7 @@
{{bin_bout.0}}
</div>
<div class="server-name">
BytesPerSec
<div class="bin_bout_text bin_bout_text_without_refresh overflow" title="{{lang.phrases.BytesPerSec}}">{{lang.phrases.BytesPerSec}}</div>
</div>
<div class="bytes" id="bout">
{% set total = bin_bout.1|int / 1024 %}
@ -96,15 +97,19 @@
{% if service == 'keepalived' %}
<div class="bin_bout" id="show_bin_bout">
<div class="server-name">
Became Master
<span class="update-icon" style="font-size: 13px; margin-top: 8px;">
<div class="bin_bout_text overflow" title="{{lang.phrases.became_master}}">{{lang.phrases.became_master}}</div>
<div class="update-icon" style="font-size: 13px; margin-top: 8px;">
<a onclick="keepalivedBecameMaster('{{ serv }}')" title="Refresh">
<span class="service-reload"></span>
</a>
</span>
</div>
</div>
<div class="bytes" id="bin">
{% if 'No such' in bin_bout %}
<span style="font-weight: normal;">{{lang.errors.cannot_get_info}} Keepalived</span>
{% else %}
{{bin_bout}}
{% endif %}
</div>
</div>
{% endif %}

View File

@ -309,6 +309,15 @@
"server_is_inaccessible_for_editing": "This server is inaccessible for editing by everyone except the admin role",
"creating_ha": "Creating a new High Availability cluster",
"adding_vrrp": "Adding a new VRRP address",
"find_in_log": "Find in a log file. Supports regular expressions.",
"exclude_in_log": "Exclude from search in a log file. Supports regular expressions.",
"bytes_in": "Bytes in",
"bytes_out": "Bytes out",
"current_ses": "Current sessions",
"total_ses": "Total sessions",
"ReqPerSec": "ReqPerSec",
"BytesPerSec": "BytesPerSec",
"became_master": "Became Master",
}
%}
{% set roles = {

View File

@ -309,6 +309,15 @@
"server_is_inaccessible_for_editing": "Ce serveur est inaccessible pour modification par tout le monde sauf le rôle d'administrateur",
"creating_ha": "Créer un nouveau cluster haute disponibilité",
"adding_vrrp": "Ajout d'une nouvelle adresse VRRP",
"find_in_log": "Rechercher dans un fichier journal. Prend en charge les expressions régulières.",
"exclude_in_log": "Exclure de la recherche dans un fichier journal. Prend en charge les expressions régulières.",
"bytes_in": "Octets dans",
"bytes_out": "Octets sortants",
"current_ses": "Séances en cours",
"total_ses": "Nombre total de séances",
"ReqPerSec": "ReqPerSec",
"BytesPerSec": "Octets par seconde",
"became_master": "Devenu maître",
}
%}
{% set roles = {

View File

@ -309,6 +309,15 @@
"server_is_inaccessible_for_editing": "Este servidor está inacessível para edição por todos, exceto a função de administrador",
"creating_ha": "Criando um novo cluster de alta disponibilidade",
"adding_vrrp": "Adicionando um novo endereço VRRP",
"find_in_log": "Encontre em um arquivo de log. Suporta expressões regulares.",
"exclude_in_log": "Excluir da pesquisa em um arquivo de log. Suporta expressões regulares.",
"bytes_in": "Bytes em",
"bytes_out": "Bytes fora",
"current_ses": "Current sessões",
"total_ses": "Total de sessões",
"ReqPerSec": "ReqPerSec",
"BytesPerSec": "Bytes Por Segundo",
"became_master": "Tornou-se mestre",
}
%}
{% set roles = {

View File

@ -125,7 +125,7 @@
%}
{% set errors = dict() %}
{% set errors = {
"cannot_get_info": "Не возможно получить информацию о",
"cannot_get_info": "Невозможно получить информацию о",
"something_wrong": "Что-то пошло не так",
"check_logs": "проверти логи",
"select_server": "Сначала выберите сервер",
@ -309,6 +309,15 @@
"server_is_inaccessible_for_editing": "Этот сервер недоступен для редактирования всеми, кроме роли администратора",
"creating_ha": "Создание нового кластера высокой доступности",
"adding_vrrp": "Добавление нового адреса VRRP",
"find_in_log": "Поиск в лог-файле. Поддерживает регулярные выражения.",
"exclude_in_log": "Исключить из поиска в лог-файле. Поддерживает регулярные выражения.",
"bytes_in": "Входящих байт",
"bytes_out": "Исходящих байт",
"current_ses": "Текущих сессий",
"total_ses": "Всего сессий",
"ReqPerSec": "Запросов в секунду",
"BytesPerSec": "Байт в секунду",
"became_master": "Стал мастером",
}
%}
{% set roles = {

View File

@ -847,6 +847,7 @@ label {
color: var(--blue-color);
border-bottom: 1px solid #A4C7F5;
width: 99%;
height: 25px;
}
.server-status {
border-radius: 50% 50%;
@ -917,6 +918,14 @@ label {
width: 110px;
margin-left: 12px;
}
.bin_bout_text {
height: 24px;
width: 90px;
float: left;
}
.bin_bout_text_without_refresh {
width: 115px;
}
.bytes {
padding-top: 17px;
padding-bottom: 12px;

View File

@ -574,8 +574,6 @@ function keepalivedBecameMaster(serv) {
data = data.replace(/\s+/g,' ');
if (data.indexOf('error:') != '-1') {
toastr.error(data);
} else if (data.indexOf('No such') != '-1') {
$("#bin_bout").html('Cannot get information');
} else {
$("#bin_bout").html(data);
$.getScript("/inc/fontawesome.min.js")