mirror of https://github.com/Aidaho12/haproxy-wi
parent
18a75dfc08
commit
e5dedade0b
30
app/funct.py
30
app/funct.py
|
@ -567,7 +567,7 @@ def install_haproxy(server_ip, **kwargs):
|
||||||
proxy_serv = ''
|
proxy_serv = ''
|
||||||
ssh_settings = return_ssh_keys_path(server_ip)
|
ssh_settings = return_ssh_keys_path(server_ip)
|
||||||
|
|
||||||
os.system("cp scripts/%s ." % script)
|
os.system(f"cp scripts/{script} .")
|
||||||
|
|
||||||
if haproxy_ver is None:
|
if haproxy_ver is None:
|
||||||
haproxy_ver = '2.6.0-1'
|
haproxy_ver = '2.6.0-1'
|
||||||
|
@ -714,13 +714,13 @@ def update_roxy_wi(service):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if service != 'roxy-wi':
|
if service != 'roxy-wi':
|
||||||
restart_service = ' && sudo systemctl restart ' + service
|
restart_service = f'&& sudo systemctl restart {service}'
|
||||||
|
|
||||||
cmd = 'sudo -S apt-get update && sudo apt-get install ' + service + restart_service
|
cmd = f'sudo -S apt-get update && sudo apt-get install {service} {restart_service}'
|
||||||
else:
|
else:
|
||||||
if service != 'roxy-wi':
|
if service != 'roxy-wi':
|
||||||
restart_service = ' && sudo systemctl restart ' + service
|
restart_service = f'&& sudo systemctl restart {service}'
|
||||||
cmd = 'sudo -S yum -y install ' + service + restart_service
|
cmd = f'sudo -S yum -y install {service} {restart_service}'
|
||||||
|
|
||||||
output, stderr = subprocess_execute(cmd)
|
output, stderr = subprocess_execute(cmd)
|
||||||
print(output)
|
print(output)
|
||||||
|
@ -818,7 +818,7 @@ def upload_and_restart(server_ip: str, cfg: str, **kwargs):
|
||||||
try:
|
try:
|
||||||
os.system(f"dos2unix {cfg}")
|
os.system(f"dos2unix {cfg}")
|
||||||
except OSError:
|
except OSError:
|
||||||
return 'Please install dos2unix'
|
return 'error: there is no dos2unix'
|
||||||
|
|
||||||
if service == "keepalived":
|
if service == "keepalived":
|
||||||
move_config = f"sudo mv -f {tmp_file} {config_path}"
|
move_config = f"sudo mv -f {tmp_file} {config_path}"
|
||||||
|
@ -853,7 +853,7 @@ def upload_and_restart(server_ip: str, cfg: str, **kwargs):
|
||||||
else:
|
else:
|
||||||
commands = [check_and_move + reload_or_restart_command]
|
commands = [check_and_move + reload_or_restart_command]
|
||||||
# if sql.return_firewall(server_ip):
|
# if sql.return_firewall(server_ip):
|
||||||
# commands[0] += open_port_firewalld(cfg, server_ip=server_ip, service='nginx')
|
# commands[0] += open_port_firewalld(cfg, server_ip=server_ip, service='apache')
|
||||||
elif service == 'waf':
|
elif service == 'waf':
|
||||||
check_and_move = f"sudo mv -f {tmp_file} {config_path}"
|
check_and_move = f"sudo mv -f {tmp_file} {config_path}"
|
||||||
if action == "save":
|
if action == "save":
|
||||||
|
@ -1157,7 +1157,7 @@ def show_roxy_log(
|
||||||
user_grep = ''
|
user_grep = ''
|
||||||
|
|
||||||
if user_group != '' and user_group != 'Default':
|
if user_group != '' and user_group != 'Default':
|
||||||
user_grep = "|grep 'group: " + user_group + "'"
|
user_grep = f"|grep 'group: {user_group}'"
|
||||||
|
|
||||||
for key, value in logs_files:
|
for key, value in logs_files:
|
||||||
if int(serv) == key:
|
if int(serv) == key:
|
||||||
|
@ -1393,7 +1393,7 @@ def check_new_version(service):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logging('Roxy-WI server', ' ' + str(e), roxywi=1)
|
logging('Roxy-WI server', f' {e}', roxywi=1)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -1543,12 +1543,12 @@ def get_services_status():
|
||||||
services = []
|
services = []
|
||||||
is_in_docker = is_docker()
|
is_in_docker = is_docker()
|
||||||
services_name = {
|
services_name = {
|
||||||
'roxy-wi-checker': 'Checker backends master service',
|
'roxy-wi-checker': 'Checker is designed for monitoring HAProxy, NGINX, Apache and Keepalived services as well as HAProxy backends and maxconn',
|
||||||
'roxy-wi-keep_alive': 'Auto start service',
|
'roxy-wi-keep_alive': ' The Auto Start service allows to restart the HAProxy, NGINX, Apache and Keepalived services if they are down',
|
||||||
'roxy-wi-metrics': 'Metrics master service',
|
'roxy-wi-metrics': 'Collects number of connections for HAProxy, NGINX, Apache and HAProxy WAF services',
|
||||||
'roxy-wi-portscanner': 'Port scanner service',
|
'roxy-wi-portscanner': 'Probes and saves a server or host for open ports',
|
||||||
'roxy-wi-smon': 'Simple monitoring network ports',
|
'roxy-wi-smon': 'SMON stands for <b>S</b>imple <b>MON</b>itoring',
|
||||||
'roxy-wi-socket': 'Socket service',
|
'roxy-wi-socket': 'Socket is a service for sending alerts and notifications',
|
||||||
'roxy-wi-prometheus-exporter': 'Prometheus exporter',
|
'roxy-wi-prometheus-exporter': 'Prometheus exporter',
|
||||||
'prometheus': 'Prometheus service',
|
'prometheus': 'Prometheus service',
|
||||||
'grafana-server': 'Grafana service',
|
'grafana-server': 'Grafana service',
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
{% if s.3|float < checker_ver|float %}
|
{% if s.3|float < checker_ver|float %}
|
||||||
{% set is_need_update = 1 %}
|
{% set is_need_update = 1 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set description = 'Checker is designed for monitoring HAProxy, Nginx, Apache and Keepalived services as well as HAProxy backends' %}
|
{% set description = 'Checker is designed for monitoring HAProxy, Nginx, Apache and Keepalived services as well as HAProxy backends and maxconn' %}
|
||||||
{% elif s.0 == 'roxy-wi-keep_alive' %}
|
{% elif s.0 == 'roxy-wi-keep_alive' %}
|
||||||
{% set service_name = 'Auto start' %}
|
{% set service_name = 'Auto start' %}
|
||||||
{% set service_link = 'auto_start' %}
|
{% set service_link = 'auto_start' %}
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
{% if s.3|float < metrics_ver|float %}
|
{% if s.3|float < metrics_ver|float %}
|
||||||
{% set is_need_update = 1 %}
|
{% set is_need_update = 1 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set description = 'Collects number of connections for HAProxy, NGINX and WAF services' %}
|
{% set description = 'Collects number of connections for HAProxy, NGINX, Apache and HAProxy WAF services' %}
|
||||||
{% elif s.0 == 'roxy-wi-portscanner' %}
|
{% elif s.0 == 'roxy-wi-portscanner' %}
|
||||||
{% set service_name = 'Port scanner' %}
|
{% set service_name = 'Port scanner' %}
|
||||||
{% set service_link = 'portscanner' %}
|
{% set service_link = 'portscanner' %}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10 third-collumn-wi" style="width: 20%;">
|
<td class="padding10 third-collumn-wi" style="width: 20%;">
|
||||||
<a href="/app/hapservers.py" title="HAProxy servers overview" class="logs_link">
|
<a href="/app/hapservers.py?service=haproxy" title="HAProxy servers overview" class="logs_link">
|
||||||
HAProxy
|
HAProxy
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10">
|
<td class="padding10">
|
||||||
<a href="/app/waf.py" title="WAf servers overview" class="logs_link">
|
<a href="/app/waf.py?service=haproxy" title="HAProxy WAF servers overview" class="logs_link">
|
||||||
WAF
|
WAF
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -440,7 +440,7 @@
|
||||||
<table class="overview-wi">
|
<table class="overview-wi">
|
||||||
<tr class="overviewHead" style="height: 30px;">
|
<tr class="overviewHead" style="height: 30px;">
|
||||||
<td class="padding10 first-collumn-wi" colspan="2">
|
<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>
|
<a href="https://roxy-wi.org/cabinet" title="Personal cabinet" class="logs_link" target="_blank">Subscription</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tbody id="sub-table"></tbody>
|
<tbody id="sub-table"></tbody>
|
||||||
|
|
Loading…
Reference in New Issue