mirror of https://github.com/Aidaho12/haproxy-wi
v1.6.1
parent
f0d593df9e
commit
612a2a112f
|
@ -150,8 +150,9 @@ def footer():
|
|||
'</center></div>'
|
||||
'<div class="footer">'
|
||||
'<div class="footer-link">'
|
||||
'<span class="LogoText">HAproxy-WI</span>')
|
||||
print('</div></div></body></html>')
|
||||
'<span class="LogoText">HAproxy-WI</span>'
|
||||
'</div>'
|
||||
'</div></body></html>')
|
||||
|
||||
def ssh_connect(serv):
|
||||
ssh = SSHClient()
|
||||
|
@ -171,8 +172,7 @@ def ssh_connect(serv):
|
|||
except paramiko.BadHostKeyException as badHostKeyException:
|
||||
print("Unable to verify server's host key: %s" % badHostKeyException)
|
||||
except Exception as e:
|
||||
print(e.args)
|
||||
|
||||
print(e.args)
|
||||
|
||||
def get_config(serv, cfg):
|
||||
os.chdir(hap_configs_dir)
|
||||
|
@ -182,12 +182,8 @@ def get_config(serv, cfg):
|
|||
sftp.get(haproxy_config_path, cfg)
|
||||
sftp.close()
|
||||
ssh.close()
|
||||
except IOError as e:
|
||||
flash(str(e)+" IOERROR")
|
||||
return ["IOERROR: " + str(e),0,0]
|
||||
except Exception as e:
|
||||
flash(str(e)+" OTHER EXCEPTION")
|
||||
return ["Error: " + str(e),0,0]
|
||||
print("!!! There was an issue, " + str(e))
|
||||
|
||||
def show_config(cfg):
|
||||
print('</center><div class="configShow">')
|
||||
|
@ -321,7 +317,10 @@ def ssh_command(serv, commands, **kwargs):
|
|||
show_log_funct = 1
|
||||
|
||||
for command in commands:
|
||||
stdin , stdout, stderr = ssh.exec_command(command)
|
||||
try:
|
||||
stdin, stdout, stderr = ssh.exec_command(command)
|
||||
except:
|
||||
continue
|
||||
|
||||
if ip is 1:
|
||||
show_ip(stdout)
|
||||
|
@ -333,7 +332,7 @@ def ssh_command(serv, commands, **kwargs):
|
|||
print(stdout.read().decode(encoding='UTF-8'))
|
||||
|
||||
print(stderr.read().decode(encoding='UTF-8'))
|
||||
ssh.close()
|
||||
#ssh.close()
|
||||
|
||||
def chooseServer(formName, title, note):
|
||||
print('<center><h2>' + title + '</h2>')
|
||||
|
|
|
@ -13,12 +13,12 @@ path_config = "haproxy-webintarface.config"
|
|||
config = configparser.ConfigParser()
|
||||
config.read(path_config)
|
||||
|
||||
commands = [ "top -u haproxy -b -n 1" ]
|
||||
commands = [ "cat /etc/haproxy/haproxy.cfg |grep -E '^listen|^backend|^frontend' |wc -l", "haproxy -v |head -1", "top -u haproxy -b -n 1" ]
|
||||
print('<h2>Quick Status </h2><table class="overview">')
|
||||
|
||||
for i in sorted(listhap.listhap):
|
||||
print('<tr><td class="overviewTr"><h3 title="IP ' + listhap.listhap.get(i) + '">Server ' + i + ':</h3></td>')
|
||||
print('<td class="overviewTd"><pre>')
|
||||
print('<td class="overviewTd">Total listen/frontend/backend:<pre>')
|
||||
funct.ssh_command(listhap.listhap.get(i), commands)
|
||||
print('</pre></td></tr>')
|
||||
|
||||
|
|
Loading…
Reference in New Issue