diff --git a/app/add.py b/app/add.py
index 7b361ed..5056c92 100644
--- a/app/add.py
+++ b/app/add.py
@@ -182,18 +182,18 @@ if form.getvalue('mode') is not None:
filter = ""
if compression == "1" or cache == "2":
filter = " filter compression\n"
- if compression == "1":
- compression_s = " compression algo gzip\n compression type text/html text/plain text/css\n"
if cache == "2":
cache_s = " http-request cache-use "+end_name+"\n http-response cache-store "+end_name+"\n"
cache_set = "cache "+end_name+"\n total-max-size 4\n max-age 240\n"
+ if compression == "1":
+ compression_s = " compression algo gzip\n compression type text/html text/plain text/css\n"
waf = ""
if form.getvalue('waf') is not None:
waf = " filter spoe engine modsecurity config "+haproxy_dir+"/waf.conf\n"
waf += " http-request deny if { var(txn.modsec.code) -m int gt 0 }\n"
- config_add = "\n" + name + "\n" + bind + mode + maxconn + balance + options_split + filter + compression_s + cache_s + waf + backend + servers_split + "\n" + cache_set
+ config_add = "\n" + name + "\n" + bind + mode + maxconn + balance + options_split + cache_s + filter + compression_s + waf + backend + servers_split + "\n" + cache_set + "\n"
if form.getvalue('new_userlist') is not None:
name = "userlist "+form.getvalue('new_userlist')+ "\n"
@@ -231,7 +231,7 @@ try:
with open(cfg, "a") as conf:
conf.write(config_add)
except IOError:
- print("Can't read import config file")
+ print("error: Can't read import config file")
funct.logging(serv, "add.py add new %s" % name)
print('
')
@@ -243,7 +243,7 @@ try:
stderr = funct.upload_and_restart(serv, cfg, just_save="save")
if stderr:
- print('
%s
X
' % stderr)
+ print('
%s
X
' % stderr)
else:
print('
' % (name, config_add, serv))
diff --git a/app/create_db.py b/app/create_db.py
index 86f1578..8b5f3d4 100644
--- a/app/create_db.py
+++ b/app/create_db.py
@@ -610,7 +610,7 @@ def update_db_v_4_4_2(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
- sql = """update version set version = '4.4.0.0'; """
+ sql = """update version set version = '4.4.1.0'; """
try:
cur.execute(sql)
con.commit()
diff --git a/app/funct.py b/app/funct.py
index 1102441..d434465 100644
--- a/app/funct.py
+++ b/app/funct.py
@@ -864,7 +864,10 @@ def haproxy_wi_log(**kwargs):
def show_ip(stdout):
for line in stdout:
- print(line)
+ if "Permission denied" in line:
+ print('error: '+line)
+ else:
+ print(line)
def server_status(stdout):
diff --git a/app/hapservers.py b/app/hapservers.py
index e29e789..317bb3f 100644
--- a/app/hapservers.py
+++ b/app/hapservers.py
@@ -49,7 +49,7 @@ for s in servers:
servers_with_status.append(s[2])
servers_with_status.append(s[11])
if service == 'nginx':
- cmd = [ "/usr/sbin/nginx -v && systemctl status nginx |grep -e 'Active\|Tasks' |awk '{print $2, $9$10$11$12$13}'" ]
+ cmd = [ "/usr/sbin/nginx -v && systemctl status nginx |grep -e 'Active' |awk '{print $2, $9$10$11$12$13}' && ps ax |grep nginx:|grep -v grep |wc -l" ]
out = funct.ssh_command(s[2], cmd)
h = ()
out1 = []
diff --git a/app/options.py b/app/options.py
index cd710f3..5509a87 100644
--- a/app/options.py
+++ b/app/options.py
@@ -1852,16 +1852,16 @@ if form.getvalue('newsmon') is not None:
try:
port = int(port)
except:
- print('error: port must number')
+ print('SMON error: port must number')
sys.exit()
if port > 65535 or port < 0:
- print('error: port must be 0-65535')
+ print('SMON error: port must be 0-65535')
sys.exit()
if port == 80 and http == 'https':
- print('error: Cannot be HTTPS with 80 port')
+ print('SMON error: Cannot be HTTPS with 80 port')
sys.exit()
if port == 443 and http == 'http':
- print('error: Cannot be HTTP with 443 port')
+ print('SMON error: Cannot be HTTP with 443 port')
sys.exit()
if sql.insert_smon(server, port, enable, http, uri, body, group, desc, telegram, user_group):
@@ -1870,7 +1870,7 @@ if form.getvalue('newsmon') is not None:
template = env.get_template('ajax/show_new_smon.html')
template = template.render(smon=sql.select_smon(user_group,ip=server,port=port,proto=http,uri=uri,body=body), telegrams=sql.get_user_telegram_by_group(user_group))
print(template)
- funct.logging('SMON','Has been add a new server '+server+' to SMON ', haproxywi=1, login=1)
+ funct.logging('SMON', ' Has been add a new server '+server+' to SMON ', haproxywi=1, login=1)
if form.getvalue('smondel') is not None:
@@ -1882,7 +1882,7 @@ if form.getvalue('smondel') is not None:
if sql.delete_smon(id, user_group):
print('Ok')
- funct.logging('SMON','Has been delete server from SMON ', haproxywi=1, login=1)
+ funct.logging('SMON', ' Has been delete server from SMON ', haproxywi=1, login=1)
if form.getvalue('showsmon') is not None:
@@ -1913,21 +1913,21 @@ if form.getvalue('updateSmonIp') is not None:
try:
port = int(port)
except:
- print('error: port must number')
+ print('SMON error: port must number')
sys.exit()
if port > 65535 or port < 0:
- print('error: port must be 0-65535')
+ print('SMON error: port must be 0-65535')
sys.exit()
if port == 80 and http == 'https':
- print('error: Cannot be https with 80 port')
+ print('SMON error: Cannot be https with 80 port')
sys.exit()
if port == 443 and http == 'http':
- print('error: Cannot be HTTP with 443 port')
+ print('SMON error: Cannot be HTTP with 443 port')
sys.exit()
if sql.update_smon(id, ip, port, body, telegram, group, desc, en):
print("Ok")
- funct.logging('SMON','Has been update the server '+ip+' to SMON ', haproxywi=1, login=1)
+ funct.logging('SMON', ' Has been update the server '+ip+' to SMON ', haproxywi=1, login=1)
if form.getvalue('showBytes') is not None:
diff --git a/app/templates/base.html b/app/templates/base.html
index 9ed83cf..06ea3a1 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -80,6 +80,7 @@
+