diff --git a/cgi-bin/funct.py b/cgi-bin/funct.py index a36ed02f..b53e62cf 100644 --- a/cgi-bin/funct.py +++ b/cgi-bin/funct.py @@ -150,8 +150,9 @@ def footer(): '' '') + 'HAproxy-WI' + '' + '') 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('
') @@ -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('

' + title + '

') diff --git a/cgi-bin/overview.py b/cgi-bin/overview.py index 54734b42..00903d36 100644 --- a/cgi-bin/overview.py +++ b/cgi-bin/overview.py @@ -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('

Quick Status

') for i in sorted(listhap.listhap): print('') - print('')

Server ' + i + ':

')
+	print('
Total listen/frontend/backend:
')
 	funct.ssh_command(listhap.listhap.get(i), commands)
 	print('