mirror of https://github.com/Aidaho12/haproxy-wi
parent
64fb9b2414
commit
79275a6360
|
@ -26,7 +26,7 @@ if act == "checkrestart":
|
|||
|
||||
|
||||
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()
|
||||
|
||||
|
||||
|
@ -1322,7 +1322,7 @@ if form.getvalue('new_waf_metrics'):
|
|||
for i in metric:
|
||||
label = str(i[2])
|
||||
label = label.split(' ')[1]
|
||||
labels += label[0]+','
|
||||
labels += label+','
|
||||
curr_con += str(i[1])+','
|
||||
|
||||
metrics['chartData']['labels'] = labels
|
||||
|
|
|
@ -26,7 +26,7 @@ def main(serv, port):
|
|||
|
||||
while True:
|
||||
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)
|
||||
except CalledProcessError as e:
|
||||
print("Command error")
|
||||
|
@ -35,11 +35,11 @@ def main(serv, port):
|
|||
sys.exit()
|
||||
readstats = readstats.decode(encoding='UTF-8')
|
||||
metric = readstats.splitlines()
|
||||
metrics = []
|
||||
|
||||
if metric:
|
||||
for i in range(0,len(metric)):
|
||||
sql.insert_waf_mentrics(serv, metric[i])
|
||||
try:
|
||||
sql.insert_waf_mentrics(serv, metric[0])
|
||||
except:
|
||||
pass
|
||||
|
||||
time.sleep(30)
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 87 KiB |
Loading…
Reference in New Issue