Changelog: https://haproxy-wi.org/changelog.py#5_2_4
pull/304/head v5.2.4.0
Pavel Loginov 2021-09-01 19:40:42 +06:00
parent 80fcff0db5
commit 341df5d75c
5 changed files with 25 additions and 12 deletions

View File

@ -237,7 +237,11 @@ def update_db_v_4_3_2_1(**kwargs):
except Exception as e:
if kwargs.get('silent') != 1:
if str(e) == 'columns param, group are not unique' or str(e) == '(1062, "Duplicate entry \'haproxy_enterprise-1\' for key \'param\'")':
if (
str(e) == 'columns param, group are not unique' or
str(e) == '(1062, "Duplicate entry \'haproxy_enterprise-1\' for key \'param\'")' or
str(e) == 'UNIQUE constraint failed: settings.param, settings.group'
):
pass
else:
print("An error occurred:", e)
@ -594,7 +598,11 @@ def update_db_v_4_5_8_2(**kwargs):
except Exception as e:
if kwargs.get('silent') != 1:
if str(e) == 'columns param, group are not unique' or str(e) == '(1062, "Duplicate entry \'maxmind_key-1\' for key \'param\'")':
if (
str(e) == 'columns param, group are not unique' or
str(e) == '(1062, "Duplicate entry \'maxmind_key-1\' for key \'param\'")' or
str(e) == 'UNIQUE constraint failed: settings.param, settings.group'
):
pass
else:
print("An error occurred:", e)
@ -686,7 +694,11 @@ def update_db_v_5_2_0(**kwargs):
desc='How many days to keep the history for the Port scanner service').execute()
except Exception as e:
if kwargs.get('silent') != 1:
if str(e) == 'columns param, group are not unique' or str(e) == '(1062, "Duplicate entry \'portscanner_keep_history_range-1\' for key \'param\'")':
if (
str(e) == 'columns param, group are not unique' or
str(e) == '(1062, "Duplicate entry \'portscanner_keep_history_range-1\' for key \'param\'")' or
str(e) == 'UNIQUE constraint failed: settings.param, settings.group'
):
pass
else:
print("An error occurred:", e)

View File

@ -1006,11 +1006,11 @@ def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', h
apache_log_path = sql.get_setting('apache_log_path')
if serv == 'roxy-wi.access.log':
cmd = "cat {}| awk -F\"/|:\" '$3>\"{}:00\" && $3<\"{}:00\"' |tail -{} {} {}".format(apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act)
cmd = "sudo cat {}| awk -F\"/|:\" '$3>\"{}:00\" && $3<\"{}:00\"' |tail -{} {} {}".format(apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act)
elif serv == 'roxy-wi.error.log':
cmd = "cat {}| awk '$4>\"{}:00\" && $4<\"{}:00\"' |tail -{} {} {}".format(apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act)
cmd = "sudo cat {}| awk '$4>\"{}:00\" && $4<\"{}:00\"' |tail -{} {} {}".format(apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act)
elif serv == 'fail2ban.log':
cmd = "cat {}| awk -F\"/|:\" '$3>\"{}:00\" && $3<\"{}:00\"' |tail -{} {} {}".format("/var/log/"+serv, date, date1, rows, grep_act, exgrep_act)
cmd = "sudo cat {}| awk -F\"/|:\" '$3>\"{}:00\" && $3<\"{}:00\"' |tail -{} {} {}".format("/var/log/"+serv, date, date1, rows, grep_act, exgrep_act)
output, stderr = subprocess_execute(cmd)
@ -1361,7 +1361,7 @@ def get_services_status():
service_ver, stderr = subprocess_execute(cmd)
try:
if service_ver[0] == 'command':
if service_ver[0] == 'command' or service_ver[0] == 'prometheus:':
service_ver[0] = ''
except Exception:
pass

View File

@ -8,6 +8,7 @@ mysql_enable = funct.get_config_var('mysql', 'enable')
def out_error(error):
error = str(error)
print('error: ' + error)
try:
funct.logging('localhost', error, haproxywi=1, login=1)
except Exception:
@ -15,7 +16,6 @@ def out_error(error):
funct.logging('localhost', error, haproxywi=1)
except Exception:
pass
print('error: '+error)
def add_user(user, email, password, role, activeuser, group):
@ -1224,7 +1224,7 @@ def select_nginx_metrics(serv, **kwargs):
def insert_waf_metrics_enable(serv, enable):
try:
server_id = Server.get(Server.ip == serv).server_id
Waf.inser(server_id=server_id, metrics=enable).execute()
Waf.insert(server_id=server_id, metrics=enable).execute()
except Exception as e:
out_error(e)

View File

@ -37,6 +37,7 @@
<tbody>
{% if smon != '' %}
{% for t in smon %}
{% set date_time = t.4|string %}
<tr>
<td class="padding10" style="width: 10%; padding: 7px 7px 7px 10px;">
{% if t.1 == 'info' %}
@ -51,9 +52,9 @@
<td>{{t.3}}</td>
{% endif %}
<td>{{t.0}}</td>
<td>{{t.4.split(' ')[0]}}
<td>{{date_time.split(' ')[0]}}
</td>
<td>{{t.4.split(' ')[1]}}</td>
<td>{{date_time.split(' ')[1]}}</td>
</tr>
{% endfor %}
{% else %}

View File

@ -144,7 +144,7 @@
</tr>
</table>
<div id="ajax-geoip"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px; margin-bottom: 15px;">
<div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px; margin-bottom: 15px;">
Read the "how to" in this <a href="https://roxy-wi.org/howto.py?howto=geoip" title="GeoLite2 description" target="_blank">article</a>
</div>
<table style="min-width: 40%;">