diff --git a/cgi-bin/funct.py b/cgi-bin/funct.py index ec86fa1b..d7627ccc 100644 --- a/cgi-bin/funct.py +++ b/cgi-bin/funct.py @@ -12,8 +12,7 @@ def check_config(): path_config = "haproxy-webintarface.config" config = configparser.ConfigParser() config.read(path_config) - - + for section in [ 'main', 'configs', 'ssh', 'logs', 'haproxy' ]: if not config.has_section(section): print('Check config file, no %s section' % section) @@ -71,6 +70,7 @@ def mode_admin(button): def links(): print('Home Page ') print('Stats ') + print('Monitoring ') print('Logs') print('Edit settings ') print(' | Configs: ') @@ -82,9 +82,8 @@ def links(): show_login_links() def head(title): - print("Content-type: text/html\n") + print('Content-type: text/html\n') print('
Note: If you reconfigure First server, second will reconfigured automatically
Note: If you reconfigure First server, second will reconfigured automatically
') def choose_server_with_vip(serv): import listserv as listhap diff --git a/cgi-bin/viewsttats.py b/cgi-bin/viewsttats.py index 193b0fb7..786a1e2f 100644 --- a/cgi-bin/viewsttats.py +++ b/cgi-bin/viewsttats.py @@ -23,9 +23,9 @@ form = cgi.FieldStorage() serv = form.getvalue('serv') if serv is None: - first_serv = list(listhap.list_hap_vip.values()) + first_serv = sorted(list(listhap.listhap.values())) serv = first_serv[0] - + try: response = requests.get('http://%s:%s/stats' % (serv, stats_port), auth=(haproxy_user, haproxy_pass)) except requests.exceptions.ConnectTimeout: @@ -34,6 +34,7 @@ except requests.exceptions.ReadTimeout: print('Oops. Read timeout occured') print("Content-type: text/html\n") +print('' % (config.get('haproxy', 'refresh_time') ,serv)) for i in listhap.listhap: if listhap.listhap.get(i) == serv: @@ -54,4 +55,3 @@ print('') data = dump.dump_all(response) print('') print(data.decode('utf-8')) - diff --git a/haproxy-webintarface.config b/haproxy-webintarface.config index eb23ed11..16343d39 100644 --- a/haproxy-webintarface.config +++ b/haproxy-webintarface.config @@ -6,16 +6,13 @@ server_port = 8000 #Log for server.py log_path = %(fullpath)s/log/ time_zone = UTC -<<<<<<< HEAD #Enable logo on top menu. Default disable logo_enable = 0 logo_path = /logo.png -======= ->>>>>>> parent of fe00260... v1.3 [configs] #Server for save configs from HAproxy servers -haproxy_configs_server = +haproxy_configs_server = localhost #Dir where configs will be save haproxy_save_configs_dir = /opt/haproxy/cgi-bin/hap_config/ @@ -28,7 +25,6 @@ ssh_user_name = root [logs] #Logs save localy, disable by default local_path_logs = /var/log/haproxy.log -# syslog_server_enable = enable syslog_server = 172.28.5.112 @@ -45,5 +41,5 @@ haproxy_config_path = /etc/haproxy/haproxy.cfg tmp_config_path = /tmp #Time in seconds for auto refresh view stats_port refresh_time = 120 -======= ->>>>>>> parent of fe00260... v1.3 + + diff --git a/index.html b/index.html index ad06937b..39c10f47 100644 --- a/index.html +++ b/index.html @@ -8,10 +8,9 @@ -<<<<<<< HEAD