diff --git a/cgi-bin/haproxy-webintarface.config b/cgi-bin/haproxy-webintarface.config index 41282f18..4c5787c4 100644 --- a/cgi-bin/haproxy-webintarface.config +++ b/cgi-bin/haproxy-webintarface.config @@ -42,6 +42,7 @@ proxy = [haproxy] #Command for restart HAproxy service restart_command = service haproxy restart +status_command = systemctl status haproxy #Username and password for Stats web page HAproxy user = admin password = password diff --git a/cgi-bin/overview.py b/cgi-bin/overview.py index 6747e0c9..4c738e7f 100644 --- a/cgi-bin/overview.py +++ b/cgi-bin/overview.py @@ -13,6 +13,8 @@ funct.check_login() path_config = "haproxy-webintarface.config" config = configparser.ConfigParser() config.read(path_config) +haproxy_config_path = config.get('haproxy', 'haproxy_config_path') +status_command = config.get('haproxy', 'status_command') USERS = '/var/www/haproxy-wi/cgi-bin/users' try: @@ -74,7 +76,7 @@ print('' listhap = funct.get_dick_after_permit() commands = [ "ps -Af |grep [h]aproxy |wc -l" ] -commands1 = [ "ls -l /etc/haproxy/haproxy.cfg |awk '{ print $6\" \"$7\" \"$8}'" ] +commands1 = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ] for i in sorted(listhap): print('
%s' % (i, i, i)) @@ -100,10 +102,10 @@ print('
' '' '') print('') -commands = [ "cat /etc/haproxy/haproxy.cfg |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l", +commands = [ "cat " + haproxy_config_path + " |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l", "uname -smor", "haproxy -v |head -1", - "systemctl status haproxy |grep Active | sed 's/^[ \t]*//'", + status_command + "|grep Active | sed 's/^[ \t]*//'", "top -u haproxy -b -n 1" ] for i in sorted(listhap): print('') diff --git a/haproxy-webintarface.config b/haproxy-webintarface.config index ca4bad26..97047f13 100644 --- a/haproxy-webintarface.config +++ b/haproxy-webintarface.config @@ -42,6 +42,7 @@ proxy = [haproxy] #Command for restart HAproxy service restart_command = service haproxy restart +status_command = systemctl status haproxy #Username and password for Stats web page HAproxy user = admin password = password

' + i + ':