mirror of https://github.com/Aidaho12/haproxy-wi
parent
f9c324da13
commit
810a9d9460
|
@ -998,7 +998,7 @@ def update_db_v_6_3_5():
|
||||||
|
|
||||||
def update_ver():
|
def update_ver():
|
||||||
try:
|
try:
|
||||||
Version.update(version='6.3.5.0').execute()
|
Version.update(version='6.3.6.0').execute()
|
||||||
except Exception:
|
except Exception:
|
||||||
print('Cannot update version')
|
print('Cannot update version')
|
||||||
|
|
||||||
|
|
|
@ -578,6 +578,16 @@ class ServiceStatus(BaseModel):
|
||||||
constraints = [SQL('UNIQUE (server_id, service_id, service_check)')]
|
constraints = [SQL('UNIQUE (server_id, service_id, service_check)')]
|
||||||
|
|
||||||
|
|
||||||
|
class KeepaliveRestart(BaseModel):
|
||||||
|
server_id = ForeignKeyField(Server, on_delete='Cascade')
|
||||||
|
service = CharField()
|
||||||
|
restarted = IntegerField(constraints=[SQL('DEFAULT 1')])
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
table_name = 'keepaplive_restarted'
|
||||||
|
constraints = [SQL('UNIQUE (server_id, service)')]
|
||||||
|
|
||||||
|
|
||||||
def create_tables():
|
def create_tables():
|
||||||
with conn:
|
with conn:
|
||||||
conn.create_tables([User, Server, Role, Telegram, Slack, UUID, Token, ApiToken, Groups, UserGroups, ConfigVersion,
|
conn.create_tables([User, Server, Role, Telegram, Slack, UUID, Token, ApiToken, Groups, UserGroups, ConfigVersion,
|
||||||
|
@ -585,4 +595,4 @@ def create_tables():
|
||||||
PortScannerSettings, PortScannerPorts, PortScannerHistory, ProvidersCreds, ServiceSetting,
|
PortScannerSettings, PortScannerPorts, PortScannerHistory, ProvidersCreds, ServiceSetting,
|
||||||
ProvisionedServers, MetricsHttpStatus, SMON, WafRules, Alerts, GeoipCodes, NginxMetrics,
|
ProvisionedServers, MetricsHttpStatus, SMON, WafRules, Alerts, GeoipCodes, NginxMetrics,
|
||||||
SystemInfo, Services, UserName, GitSetting, CheckerSetting, ApacheMetrics, ProvisionParam,
|
SystemInfo, Services, UserName, GitSetting, CheckerSetting, ApacheMetrics, ProvisionParam,
|
||||||
WafNginx, ServiceStatus])
|
WafNginx, ServiceStatus, KeepaliveRestart])
|
||||||
|
|
|
@ -2242,7 +2242,7 @@ def select_keepalived_alert(**kwargs):
|
||||||
|
|
||||||
|
|
||||||
def select_keep_alive():
|
def select_keep_alive():
|
||||||
query = Server.select(Server.ip, Server.groups).where(Server.active == 1)
|
query = Server.select(Server.ip, Server.groups, Server.server_id).where(Server.active == 1)
|
||||||
try:
|
try:
|
||||||
query_res = query.execute()
|
query_res = query.execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -2252,7 +2252,7 @@ def select_keep_alive():
|
||||||
|
|
||||||
|
|
||||||
def select_nginx_keep_alive():
|
def select_nginx_keep_alive():
|
||||||
query = Server.select(Server.ip, Server.groups).where(Server.nginx_active == 1)
|
query = Server.select(Server.ip, Server.groups, Server.server_id).where(Server.nginx_active == 1)
|
||||||
try:
|
try:
|
||||||
query_res = query.execute()
|
query_res = query.execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -2262,7 +2262,7 @@ def select_nginx_keep_alive():
|
||||||
|
|
||||||
|
|
||||||
def select_apache_keep_alive():
|
def select_apache_keep_alive():
|
||||||
query = Server.select(Server.ip, Server.groups).where(Server.apache_active == 1)
|
query = Server.select(Server.ip, Server.groups, Server.server_id).where(Server.apache_active == 1)
|
||||||
try:
|
try:
|
||||||
query_res = query.execute()
|
query_res = query.execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -2272,7 +2272,7 @@ def select_apache_keep_alive():
|
||||||
|
|
||||||
|
|
||||||
def select_keepalived_keep_alive():
|
def select_keepalived_keep_alive():
|
||||||
query = Server.select(Server.ip, Server.port, Server.groups).where(Server.keepalived_active == 1)
|
query = Server.select(Server.ip, Server.port, Server.groups, Server.server_id).where(Server.keepalived_active == 1)
|
||||||
try:
|
try:
|
||||||
query_res = query.execute()
|
query_res = query.execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -2290,6 +2290,26 @@ def select_keepalived(serv):
|
||||||
return keepalived
|
return keepalived
|
||||||
|
|
||||||
|
|
||||||
|
def select_update_keep_alive_restart(server_id: int, service: str) -> int:
|
||||||
|
try:
|
||||||
|
restarted = KeepaliveRestart.get(
|
||||||
|
(KeepaliveRestart.server_id == server_id) &
|
||||||
|
(KeepaliveRestart.service == service)
|
||||||
|
).restarted
|
||||||
|
except Exception as e:
|
||||||
|
out_error(e)
|
||||||
|
else:
|
||||||
|
return restarted or 0
|
||||||
|
|
||||||
|
|
||||||
|
def update_keep_alive_restart(server_id: int, service: str, restarted: int) -> None:
|
||||||
|
query = KeepaliveRestart.insert(server_id=server_id, service=service, restarted=restarted).on_conflict('replace')
|
||||||
|
try:
|
||||||
|
query.execute()
|
||||||
|
except Exception as e:
|
||||||
|
out_error(e)
|
||||||
|
|
||||||
|
|
||||||
def update_keepalived(serv):
|
def update_keepalived(serv):
|
||||||
query = Server.update(keepalived='1').where(Server.ip == serv)
|
query = Server.update(keepalived='1').where(Server.ip == serv)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
global
|
global
|
||||||
log 127.0.0.1 local2
|
log 127.0.0.2 local0
|
||||||
|
log 127.0.0.1 local1 notice
|
||||||
chroot /var/lib/haproxy
|
chroot /var/lib/haproxy
|
||||||
pidfile /var/run/haproxy.pid
|
pidfile /var/run/haproxy.pid
|
||||||
maxconn 4000
|
maxconn 4000
|
||||||
|
@ -31,9 +32,7 @@ defaults
|
||||||
|
|
||||||
listen stats
|
listen stats
|
||||||
bind *:{{STAT_PORT}}
|
bind *:{{STAT_PORT}}
|
||||||
{% if ansible_os_family == "RedHat" %}
|
|
||||||
http-request use-service prometheus-exporter if { path /metrics }
|
http-request use-service prometheus-exporter if { path /metrics }
|
||||||
{% endif %}
|
|
||||||
stats enable
|
stats enable
|
||||||
stats uri /stats
|
stats uri /stats
|
||||||
stats realm HAProxy-04\ Statistics
|
stats realm HAProxy-04\ Statistics
|
||||||
|
|
|
@ -7,10 +7,8 @@ module(load="builtin:omfile")
|
||||||
if $programname startswith 'haproxy' then {
|
if $programname startswith 'haproxy' then {
|
||||||
if $syslogseverity == 6 then
|
if $syslogseverity == 6 then
|
||||||
action(type="omfile" file="/var/log/haproxy/access.log")
|
action(type="omfile" file="/var/log/haproxy/access.log")
|
||||||
stop
|
|
||||||
if $syslogseverity <= 3 then
|
if $syslogseverity <= 3 then
|
||||||
action(type="omfile" file="/var/log/haproxy/error.log")
|
action(type="omfile" file="/var/log/haproxy/error.log")
|
||||||
stop
|
|
||||||
if $syslogseverity <= 5 then
|
if $syslogseverity <= 5 then
|
||||||
action(type="omfile" file="/var/log/haproxy/status.log")
|
action(type="omfile" file="/var/log/haproxy/status.log")
|
||||||
stop
|
stop
|
||||||
|
|
|
@ -157,3 +157,9 @@
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<style>
|
||||||
|
.overview-wi {
|
||||||
|
min-width: 50px;
|
||||||
|
width: 445px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
data-something_wrong="{{lang.words.something_wrong}}" data-check_logs="{{lang.words.check_logs}}" data-wait_mess="{{lang.phrases.wait_mess}}"
|
data-something_wrong="{{lang.words.something_wrong}}" data-check_logs="{{lang.words.check_logs}}" data-wait_mess="{{lang.phrases.wait_mess}}"
|
||||||
data-just_save="{{lang.words.just|title()}} {{lang.words.save}}" data-upload_and_restart="{{lang.phrases.upload_and_restart|title()}}"
|
data-just_save="{{lang.words.just|title()}} {{lang.words.save}}" data-upload_and_restart="{{lang.phrases.upload_and_restart|title()}}"
|
||||||
data-are_you_sure="{{lang.phrases.are_you_sure}}" data-upload_and_reload="{{lang.phrases.upload_and_reload|title()}}" data-select_server="{{lang.errors.select_server}}"
|
data-are_you_sure="{{lang.phrases.are_you_sure}}" data-upload_and_reload="{{lang.phrases.upload_and_reload|title()}}" data-select_server="{{lang.errors.select_server}}"
|
||||||
data-empty_name="{{lang.errors.empty_name}}" data-edit="{{lang.words.edit|title()}}" data-close="{{lang.words.close|title()}}"
|
data-empty_name="{{lang.errors.empty_name}}" data-edit="{{lang.words.edit|title()}}" data-close="{{lang.words.close|title()}}" data-server_info="{{lang.phrases.server_info}}"
|
||||||
data-generated_config="{{lang.words.generated|title()}} {{lang.words.config}}" />
|
data-generated_config="{{lang.words.generated|title()}} {{lang.words.config}}" />
|
||||||
{% if title == 'Login page' %}
|
{% if title == 'Login page' %}
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=1">
|
<meta name="viewport" content="width=device-width, user-scalable=1">
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<td id="cur_haproxy_exp_ver" class="padding10 first-collumn"></td>
|
<td id="cur_haproxy_exp_ver" class="padding10 first-collumn"></td>
|
||||||
<td class="padding10 first-collumn" style="width: 20%;">
|
<td class="padding10 first-collumn" style="width: 20%;">
|
||||||
{% set values = dict() %}
|
{% set values = dict() %}
|
||||||
{% set values = {'0.8.0':'0.8.0', '0.9.0':'0.9.0', '0.10.0':'0.10.0', '0.11.0':'0.11.0', '0.12.0':'0.12.0', '0.13.0':'0.13.0', '0.14.0':'0.14.0'} %}
|
{% set values = {'0.9.0':'0.9.0', '0.10.0':'0.10.0', '0.11.0':'0.11.0', '0.12.0':'0.12.0', '0.13.0':'0.13.0', '0.14.0':'0.14.0', '0.15.0':'0.15.0'} %}
|
||||||
{{ select('hapexpver', values=values, selected='0.14.0') }}
|
{{ select('hapexpver', values=values, selected='0.14.0') }}
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10 first-collumn">
|
<td class="padding10 first-collumn">
|
||||||
|
|
|
@ -231,6 +231,7 @@
|
||||||
%}
|
%}
|
||||||
{% set phrases = dict() %}
|
{% set phrases = dict() %}
|
||||||
{% set phrases = {
|
{% set phrases = {
|
||||||
|
"config_file_name": "Config file name",
|
||||||
"no_events_added": "No events added yet.",
|
"no_events_added": "No events added yet.",
|
||||||
"upload_and_restart": "Upload and restart",
|
"upload_and_restart": "Upload and restart",
|
||||||
"upload_and_reload": "Upload and reload",
|
"upload_and_reload": "Upload and reload",
|
||||||
|
@ -290,6 +291,7 @@
|
||||||
"how_to_install": "how to install",
|
"how_to_install": "how to install",
|
||||||
"port_check": "port check",
|
"port_check": "port check",
|
||||||
"possible_service_name": "Possible service name",
|
"possible_service_name": "Possible service name",
|
||||||
|
"server_info": "Server info",
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
{% set roles = {
|
{% set roles = {
|
||||||
|
@ -503,7 +505,7 @@
|
||||||
"creds2": "credentials",
|
"creds2": "credentials",
|
||||||
"settings": "settings",
|
"settings": "settings",
|
||||||
"settings2": "settings",
|
"settings2": "settings",
|
||||||
"installat": "installat",
|
"install": "install",
|
||||||
"installation": "installation",
|
"installation": "installation",
|
||||||
"installing": "installing",
|
"installing": "installing",
|
||||||
"proxy": "proxy",
|
"proxy": "proxy",
|
||||||
|
|
|
@ -231,6 +231,7 @@
|
||||||
%}
|
%}
|
||||||
{% set phrases = dict() %}
|
{% set phrases = dict() %}
|
||||||
{% set phrases = {
|
{% set phrases = {
|
||||||
|
"config_file_name": "Имя конфиг файла",
|
||||||
"no_events_added": "События еще не добавлены.",
|
"no_events_added": "События еще не добавлены.",
|
||||||
"upload_and_restart": "Загрузить и перезагрузить",
|
"upload_and_restart": "Загрузить и перезагрузить",
|
||||||
"upload_and_reload": "Загрузить и перезапустить",
|
"upload_and_reload": "Загрузить и перезапустить",
|
||||||
|
@ -292,6 +293,7 @@
|
||||||
"how_to_install": "как установить",
|
"how_to_install": "как установить",
|
||||||
"port_check": "проверка порта",
|
"port_check": "проверка порта",
|
||||||
"possible_service_name": "Возможное название службы",
|
"possible_service_name": "Возможное название службы",
|
||||||
|
"server_info": "Информация о сервере",
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
{% set roles = {
|
{% set roles = {
|
||||||
|
@ -817,5 +819,6 @@
|
||||||
"rule_name": "Название правила",
|
"rule_name": "Название правила",
|
||||||
"rule": "правило",
|
"rule": "правило",
|
||||||
"rules": "правила",
|
"rules": "правила",
|
||||||
|
"send": "отправить",
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
13
inc/users.js
13
inc/users.js
|
@ -2833,6 +2833,8 @@ function updateServerInfo(ip, id) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function showServerInfo(id, ip) {
|
function showServerInfo(id, ip) {
|
||||||
|
var close_word = $('#translate').attr('data-close');
|
||||||
|
var server_info = $('#translate').attr('data-server_info');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -2851,14 +2853,15 @@ function showServerInfo(id, ip) {
|
||||||
$("#dialog-server-info").dialog({
|
$("#dialog-server-info").dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
height: "auto",
|
height: "auto",
|
||||||
width: 1250,
|
width: 1000,
|
||||||
modal: true,
|
modal: true,
|
||||||
title: "Server info (" + ip + ")",
|
title: server_info + " (" + ip + ")",
|
||||||
buttons: {
|
buttons: [{
|
||||||
Close: function () {
|
text: close_word,
|
||||||
|
click: function () {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
});
|
});
|
||||||
$.getScript(awesome);
|
$.getScript(awesome);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue