From 3fd324f0b3fbb61307cddf5cf29a4cadce66b60c Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Mon, 24 Feb 2020 10:25:28 +0100 Subject: [PATCH] v4.0.0.0 Changelog: https://haproxy-wi.org/changelog.py#4 --- README.md | 4 ++-- app/funct.py | 5 +++-- app/options.py | 13 +++++++++++-- app/templates/hapservers.html | 6 +++--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 95d3f32f..df8b962a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi 12. Auto management of ports assigned to Fronted. 13. Evaluate the changes of recent configs pushed to HAProxy, Nginx and Keepalived instances straight from web ui 14. Multiple User Roles support for privileged based Viewing and editing of Config -15. Create Groups and add /remove servers to ensure proper identification for your HAProxy Clusters +15. Create Groups and add/remove servers to ensure proper identification for your HAProxy, Nginx Clusters 16. Send notifications to telegram directly from HAProxy-WI 17. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured 18. SSL certificate support. @@ -45,7 +45,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi 28. Ability to hide parts of the config with tags for users with "guest" role: "HideBlockStart" and "HideBlockEnd" 29. Mobile-ready desing 30. REST API -31. Backup HAProxy's and Keepalived's config files through HAProxy-WI +31. Backup HAProxy's, Nginx's and Keepalived's config files through HAProxy-WI ![alt text](image/haproxy-wi-metrics.png "Merics") diff --git a/app/funct.py b/app/funct.py index 98283c48..cba5a0cd 100644 --- a/app/funct.py +++ b/app/funct.py @@ -811,12 +811,13 @@ def get_files(dir = get_config_var('configs', 'haproxy_save_configs_dir'), forma else: file = set() return_files = set() - + i = 0 for files in glob.glob(os.path.join(dir,'*.'+format)): if format == 'log': - file += [(files.split('/')[5], files.split('/')[5])] + file += [(i, files.split('/')[5])] else: file.add(files.split('/')[-1]) + i += 1 files = sorted(file, reverse=True) if format == 'cfg' or format == 'conf': diff --git a/app/options.py b/app/options.py index 97dac130..f7e4a85e 100644 --- a/app/options.py +++ b/app/options.py @@ -429,7 +429,7 @@ if serv is not None and form.getvalue('rows1') is not None: if serv == 'haproxy-wi.access.log': cmd="cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, grep) - else: + elif serv == 'haproxy-wi.error.log': cmd="cat %s| awk '$4>\"%s:00\" && $4<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, grep) output, stderr = funct.subprocess_execute(cmd) @@ -455,7 +455,16 @@ if form.getvalue('viewlogs') is not None: else: grep_act = '' grep = '' - + + logs_files = funct.get_files(log_path, format="log") + for key, value in logs_files: + if int(viewlog) == key: + viewlog = value + break + else: + print('Haha') + sys.exit() + if viewlog == 'backup.log': cmd="cat %s| awk '$2>\"%s:00\" && $2<\"%s:00\"' |tail -%s %s %s" % (log_path + viewlog, date, date1, rows, grep_act, grep) else: diff --git a/app/templates/hapservers.html b/app/templates/hapservers.html index 23042266..a9e211ca 100644 --- a/app/templates/hapservers.html +++ b/app/templates/hapservers.html @@ -88,13 +88,13 @@ {% else %} {% set action_service = 'hap' %} {% endif %} - + - + - +