Pavel Loginov 2020-07-04 15:48:23 +02:00
parent 64fb9b2414
commit 79275a6360
3 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@ if act == "checkrestart":
if not sql.check_token_exists(form.getvalue("token")): if not sql.check_token_exists(form.getvalue("token")):
print("Your token has been expired") print('<div class="alert alert-danger" style="margin:20px;">Your token has been expired</div>')
sys.exit() sys.exit()
@ -1322,7 +1322,7 @@ if form.getvalue('new_waf_metrics'):
for i in metric: for i in metric:
label = str(i[2]) label = str(i[2])
label = label.split(' ')[1] label = label.split(' ')[1]
labels += label[0]+',' labels += label+','
curr_con += str(i[1])+',' curr_con += str(i[1])+','
metrics['chartData']['labels'] = labels metrics['chartData']['labels'] = labels

View File

@ -26,7 +26,7 @@ def main(serv, port):
while True: while True:
try: try:
cmd = "echo 'show stat' |nc "+serv+" "+port+" | cut -d ',' -f 1-2,34 |grep waf |grep BACKEND |awk -F',' '{print $3}'" cmd = "echo 'show stat' |nc "+serv+" "+port+" | cut -d ',' -f 1-2,5 |grep waf |grep BACKEND |awk -F',' '{print $3}'"
readstats = subprocess.check_output([cmd], shell=True) readstats = subprocess.check_output([cmd], shell=True)
except CalledProcessError as e: except CalledProcessError as e:
print("Command error") print("Command error")
@ -35,11 +35,11 @@ def main(serv, port):
sys.exit() sys.exit()
readstats = readstats.decode(encoding='UTF-8') readstats = readstats.decode(encoding='UTF-8')
metric = readstats.splitlines() metric = readstats.splitlines()
metrics = []
if metric: try:
for i in range(0,len(metric)): sql.insert_waf_mentrics(serv, metric[0])
sql.insert_waf_mentrics(serv, metric[i]) except:
pass
time.sleep(30) time.sleep(30)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 87 KiB