mirror of https://github.com/Aidaho12/haproxy-wi
parent
80fcff0db5
commit
341df5d75c
|
@ -237,7 +237,11 @@ def update_db_v_4_3_2_1(**kwargs):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if kwargs.get('silent') != 1:
|
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
|
pass
|
||||||
else:
|
else:
|
||||||
print("An error occurred:", e)
|
print("An error occurred:", e)
|
||||||
|
@ -594,7 +598,11 @@ def update_db_v_4_5_8_2(**kwargs):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if kwargs.get('silent') != 1:
|
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
|
pass
|
||||||
else:
|
else:
|
||||||
print("An error occurred:", e)
|
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()
|
desc='How many days to keep the history for the Port scanner service').execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if kwargs.get('silent') != 1:
|
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
|
pass
|
||||||
else:
|
else:
|
||||||
print("An error occurred:", e)
|
print("An error occurred:", e)
|
||||||
|
|
|
@ -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')
|
apache_log_path = sql.get_setting('apache_log_path')
|
||||||
|
|
||||||
if serv == 'roxy-wi.access.log':
|
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':
|
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':
|
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)
|
output, stderr = subprocess_execute(cmd)
|
||||||
|
|
||||||
|
@ -1361,7 +1361,7 @@ def get_services_status():
|
||||||
service_ver, stderr = subprocess_execute(cmd)
|
service_ver, stderr = subprocess_execute(cmd)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if service_ver[0] == 'command':
|
if service_ver[0] == 'command' or service_ver[0] == 'prometheus:':
|
||||||
service_ver[0] = ''
|
service_ver[0] = ''
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -8,6 +8,7 @@ mysql_enable = funct.get_config_var('mysql', 'enable')
|
||||||
|
|
||||||
def out_error(error):
|
def out_error(error):
|
||||||
error = str(error)
|
error = str(error)
|
||||||
|
print('error: ' + error)
|
||||||
try:
|
try:
|
||||||
funct.logging('localhost', error, haproxywi=1, login=1)
|
funct.logging('localhost', error, haproxywi=1, login=1)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -15,7 +16,6 @@ def out_error(error):
|
||||||
funct.logging('localhost', error, haproxywi=1)
|
funct.logging('localhost', error, haproxywi=1)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
print('error: '+error)
|
|
||||||
|
|
||||||
|
|
||||||
def add_user(user, email, password, role, activeuser, group):
|
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):
|
def insert_waf_metrics_enable(serv, enable):
|
||||||
try:
|
try:
|
||||||
server_id = Server.get(Server.ip == serv).server_id
|
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:
|
except Exception as e:
|
||||||
out_error(e)
|
out_error(e)
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% if smon != '' %}
|
{% if smon != '' %}
|
||||||
{% for t in smon %}
|
{% for t in smon %}
|
||||||
|
{% set date_time = t.4|string %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="padding10" style="width: 10%; padding: 7px 7px 7px 10px;">
|
<td class="padding10" style="width: 10%; padding: 7px 7px 7px 10px;">
|
||||||
{% if t.1 == 'info' %}
|
{% if t.1 == 'info' %}
|
||||||
|
@ -51,9 +52,9 @@
|
||||||
<td>{{t.3}}</td>
|
<td>{{t.3}}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>{{t.0}}</td>
|
<td>{{t.0}}</td>
|
||||||
<td>{{t.4.split(' ')[0]}}
|
<td>{{date_time.split(' ')[0]}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{t.4.split(' ')[1]}}</td>
|
<td>{{date_time.split(' ')[1]}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="ajax-geoip"></div>
|
<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>
|
Read the "how to" in this <a href="https://roxy-wi.org/howto.py?howto=geoip" title="GeoLite2 description" target="_blank">article</a>
|
||||||
</div>
|
</div>
|
||||||
<table style="min-width: 40%;">
|
<table style="min-width: 40%;">
|
||||||
|
|
Loading…
Reference in New Issue