mirror of https://github.com/Aidaho12/haproxy-wi
v3.10.0.0
parent
ab1e72a5bc
commit
859bf81ed9
|
@ -64,6 +64,8 @@ Supports EL7 and EL8
|
||||||
|
|
||||||
#### Before uses RPM repository you should donate to support project on [Patreon](https://www.patreon.com/haproxy_wi/overview) or on [PayPal](https://www.paypal.me/loginovpavel) and I will send you credentials for access. Actual prices you can see on [Patreon](https://www.patreon.com/haproxy_wi/overview)
|
#### Before uses RPM repository you should donate to support project on [Patreon](https://www.patreon.com/haproxy_wi/overview) or on [PayPal](https://www.paypal.me/loginovpavel) and I will send you credentials for access. Actual prices you can see on [Patreon](https://www.patreon.com/haproxy_wi/overview)
|
||||||
|
|
||||||
|
### More information on the official [site](https://haproxy-wi.org/installation.py#rpm)
|
||||||
|
|
||||||
## Manual install
|
## Manual install
|
||||||
For install just clone:
|
For install just clone:
|
||||||
```
|
```
|
||||||
|
@ -178,6 +180,8 @@ For Apache do virtualhost with cgi-bin. Like this:
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### More information on the official [site](https://haproxy-wi.org/installation.py#manual)
|
||||||
|
|
||||||
# OS support
|
# OS support
|
||||||
HAProxy-WI was tested on EL7, EL8 and all scripts too. Debian/Ubuntu OS support at 'beta' stage, may work not correct
|
HAProxy-WI was tested on EL7, EL8 and all scripts too. Debian/Ubuntu OS support at 'beta' stage, may work not correct
|
||||||
|
|
||||||
|
@ -192,6 +196,9 @@ MariaDB [(none)]> create database haproxywi;
|
||||||
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'%' IDENTIFIED BY 'haproxy-wi';
|
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'%' IDENTIFIED BY 'haproxy-wi';
|
||||||
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'localhost' IDENTIFIED BY 'haproxy-wi';
|
MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'localhost' IDENTIFIED BY 'haproxy-wi';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### More information on the official [site](https://haproxy-wi.org/settings.py#db_settings)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
|
|
@ -459,7 +459,7 @@ def update_db_v_3_8_1(**kwargs):
|
||||||
|
|
||||||
def update_ver(**kwargs):
|
def update_ver(**kwargs):
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """update version set version = '3.9.4'; """
|
sql = """update version set version = '3.10.0.0'; """
|
||||||
try:
|
try:
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
con.commit()
|
con.commit()
|
||||||
|
|
20
app/funct.py
20
app/funct.py
|
@ -99,7 +99,7 @@ def telegram_send_mess(mess, **kwargs):
|
||||||
token_bot = telegram[1]
|
token_bot = telegram[1]
|
||||||
channel_name = telegram[2]
|
channel_name = telegram[2]
|
||||||
|
|
||||||
if proxy is not None:
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
apihelper.proxy = {'https': proxy}
|
apihelper.proxy = {'https': proxy}
|
||||||
try:
|
try:
|
||||||
bot = telebot.TeleBot(token=token_bot)
|
bot = telebot.TeleBot(token=token_bot)
|
||||||
|
@ -359,8 +359,12 @@ def install_haproxy(serv, **kwargs):
|
||||||
|
|
||||||
if hapver is None:
|
if hapver is None:
|
||||||
hapver = '2.0.7-1'
|
hapver = '2.0.7-1'
|
||||||
|
|
||||||
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
|
proxy_serv = proxy
|
||||||
|
else:
|
||||||
|
proxy_serv = ''
|
||||||
|
|
||||||
proxy_serv = proxy if proxy is not None else ''
|
|
||||||
syn_flood_protect = '1' if kwargs.get('syn_flood') == "1" else ''
|
syn_flood_protect = '1' if kwargs.get('syn_flood') == "1" else ''
|
||||||
|
|
||||||
commands = [ "chmod +x "+script +" && ./"+script +" PROXY=" + proxy_serv+
|
commands = [ "chmod +x "+script +" && ./"+script +" PROXY=" + proxy_serv+
|
||||||
|
@ -400,7 +404,12 @@ def waf_install(serv, **kwargs):
|
||||||
|
|
||||||
os.system("cp scripts/%s ." % script)
|
os.system("cp scripts/%s ." % script)
|
||||||
|
|
||||||
commands = [ "sudo chmod +x "+tmp_config_path+script+" && " +tmp_config_path+script +" PROXY=" + proxy+
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
|
proxy_serv = proxy
|
||||||
|
else:
|
||||||
|
proxy_serv = ''
|
||||||
|
|
||||||
|
commands = [ "sudo chmod +x "+tmp_config_path+script+" && " +tmp_config_path+script +" PROXY=" + proxy_serv+
|
||||||
" HAPROXY_PATH="+haproxy_dir +" VERSION="+ver ]
|
" HAPROXY_PATH="+haproxy_dir +" VERSION="+ver ]
|
||||||
|
|
||||||
error = str(upload(serv, tmp_config_path, script))
|
error = str(upload(serv, tmp_config_path, script))
|
||||||
|
@ -651,8 +660,8 @@ def ssh_command(serv, commands, **kwargs):
|
||||||
try:
|
try:
|
||||||
ssh.close()
|
ssh.close()
|
||||||
except:
|
except:
|
||||||
print("<div class='alert alert-danger' style='margin: 0;'>"+str(ssh)+"<a title='Close' id='errorMess'><b>X</b></a></div>")
|
|
||||||
logging('localhost', ' '+str(ssh), haproxywi=1)
|
logging('localhost', ' '+str(ssh), haproxywi=1)
|
||||||
|
return "<div class='alert alert-danger' style='margin: 0;'>"+str(ssh)+"<a title='Close' id='errorMess'><b>X</b></a></div>"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -731,13 +740,12 @@ def check_ver():
|
||||||
|
|
||||||
def check_new_version():
|
def check_new_version():
|
||||||
import requests
|
import requests
|
||||||
import ssl
|
|
||||||
import sql
|
import sql
|
||||||
|
|
||||||
proxy = sql.get_setting('proxy')
|
proxy = sql.get_setting('proxy')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if proxy:
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
proxyDict = { "https" : proxy, "http" : proxy }
|
proxyDict = { "https" : proxy, "http" : proxy }
|
||||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver=1', timeout=1, proxies=proxyDict)
|
response = requests.get('https://haproxy-wi.org/update.py?last_ver=1', timeout=1, proxies=proxyDict)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,14 +27,11 @@ serv = form.getvalue('serv')
|
||||||
if serv:
|
if serv:
|
||||||
servers = sql.select_servers(server=serv)
|
servers = sql.select_servers(server=serv)
|
||||||
autorefresh = 1
|
autorefresh = 1
|
||||||
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
|
||||||
else:
|
else:
|
||||||
servers = sql.get_dick_permit()
|
servers = sql.get_dick_permit()
|
||||||
autorefresh = 0
|
autorefresh = 0
|
||||||
|
|
||||||
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
||||||
haproxy_config_path = sql.get_setting('haproxy_config_path')
|
|
||||||
commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
|
|
||||||
servers_with_status1 = []
|
servers_with_status1 = []
|
||||||
out1 = ""
|
out1 = ""
|
||||||
for s in servers:
|
for s in servers:
|
||||||
|
@ -52,22 +49,6 @@ for s in servers:
|
||||||
out1 = False
|
out1 = False
|
||||||
servers_with_status.append(out1)
|
servers_with_status.append(out1)
|
||||||
servers_with_status.append(s[12])
|
servers_with_status.append(s[12])
|
||||||
try:
|
|
||||||
servers_with_status.append(funct.ssh_command(s[2], commands))
|
|
||||||
except:
|
|
||||||
servers_with_status.append('Cannot get last date')
|
|
||||||
|
|
||||||
if serv:
|
|
||||||
try:
|
|
||||||
sections = funct.get_sections(hap_configs_dir +funct.get_files()[0])
|
|
||||||
except:
|
|
||||||
try:
|
|
||||||
cfg = hap_configs_dir + s[2] + "-" + funct.get_data('config') + ".cfg"
|
|
||||||
error = funct.get_config(s[2], cfg)
|
|
||||||
sections = funct.get_sections(cfg)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
servers_with_status.append(sections)
|
|
||||||
|
|
||||||
servers_with_status1.append(servers_with_status)
|
servers_with_status1.append(servers_with_status)
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,42 @@ if form.getvalue('action_waf') is not None and serv is not None:
|
||||||
funct.ssh_command(serv, commands)
|
funct.ssh_command(serv, commands)
|
||||||
|
|
||||||
|
|
||||||
|
if act == "overviewHapserverBackends":
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
||||||
|
template = env.get_template('haproxyservers_backends.html')
|
||||||
|
|
||||||
|
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
||||||
|
try:
|
||||||
|
sections = funct.get_sections(hap_configs_dir +funct.get_files()[0])
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
cfg = hap_configs_dir + serv + "-" + funct.get_data('config') + ".cfg"
|
||||||
|
except:
|
||||||
|
funct.logging('localhost', ' Cannot generate cfg path', haproxywi=1)
|
||||||
|
try:
|
||||||
|
error = funct.get_config(serv, cfg)
|
||||||
|
except:
|
||||||
|
funct.logging('localhost', ' Cannot download config', haproxywi=1)
|
||||||
|
try:
|
||||||
|
sections = funct.get_sections(cfg)
|
||||||
|
except:
|
||||||
|
funct.logging('localhost', ' Cannot get sections from config file', haproxywi=1)
|
||||||
|
sections = 'Cannot get backends'
|
||||||
|
|
||||||
|
template = template.render(backends=sections, serv=serv)
|
||||||
|
print(template)
|
||||||
|
|
||||||
|
|
||||||
|
if act == "overviewHapservers":
|
||||||
|
haproxy_config_path = sql.get_setting('haproxy_config_path')
|
||||||
|
commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
|
||||||
|
try:
|
||||||
|
print(funct.ssh_command(serv, commands))
|
||||||
|
except:
|
||||||
|
print('Cannot get last date')
|
||||||
|
|
||||||
|
|
||||||
if act == "overview":
|
if act == "overview":
|
||||||
import asyncio
|
import asyncio
|
||||||
async def async_get_overview(serv1, serv2):
|
async def async_get_overview(serv1, serv2):
|
||||||
|
@ -170,7 +206,7 @@ if act == "overview":
|
||||||
template = env.get_template('overview.html')
|
template = env.get_template('overview.html')
|
||||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||||
user_id = cookie.get('uuid')
|
user_id = cookie.get('uuid')
|
||||||
futures = [async_get_overview(server[1], server[2]) for server in sql.get_dick_permit()]
|
futures = [async_get_overview(server[1], server[2]) for server in sql.select_servers(server=serv)]
|
||||||
for i, future in enumerate(asyncio.as_completed(futures)):
|
for i, future in enumerate(asyncio.as_completed(futures)):
|
||||||
result = await future
|
result = await future
|
||||||
servers.append(result)
|
servers.append(result)
|
||||||
|
@ -587,7 +623,10 @@ if form.getvalue('master'):
|
||||||
if ssh_enable == 0:
|
if ssh_enable == 0:
|
||||||
ssh_key_name = ''
|
ssh_key_name = ''
|
||||||
|
|
||||||
proxy_serv = proxy if proxy is not None else ""
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
|
proxy_serv = proxy
|
||||||
|
else:
|
||||||
|
proxy_serv = ''
|
||||||
|
|
||||||
os.system("cp scripts/%s ." % script)
|
os.system("cp scripts/%s ." % script)
|
||||||
|
|
||||||
|
@ -663,7 +702,10 @@ if form.getvalue('masteradd'):
|
||||||
if ssh_enable == 0:
|
if ssh_enable == 0:
|
||||||
ssh_key_name = ''
|
ssh_key_name = ''
|
||||||
|
|
||||||
proxy_serv = proxy if proxy is not None else ""
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
|
proxy_serv = proxy
|
||||||
|
else:
|
||||||
|
proxy_serv = ''
|
||||||
|
|
||||||
os.system("cp scripts/%s ." % script)
|
os.system("cp scripts/%s ." % script)
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ try:
|
||||||
keep_alive, stderr = funct.subprocess_execute(cmd)
|
keep_alive, stderr = funct.subprocess_execute(cmd)
|
||||||
cmd = "ps ax |grep '(wsgi:api)'|grep -v grep|wc -l"
|
cmd = "ps ax |grep '(wsgi:api)'|grep -v grep|wc -l"
|
||||||
api, stderr = funct.subprocess_execute(cmd)
|
api, stderr = funct.subprocess_execute(cmd)
|
||||||
|
servers = sql.get_dick_permit()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -55,5 +56,6 @@ template = template.render(h2 = 1,
|
||||||
error = stderr,
|
error = stderr,
|
||||||
versions = funct.versions(),
|
versions = funct.versions(),
|
||||||
haproxy_wi_log = funct.haproxy_wi_log(),
|
haproxy_wi_log = funct.haproxy_wi_log(),
|
||||||
|
servers = servers,
|
||||||
token = token)
|
token = token)
|
||||||
print(template)
|
print(template)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<style>
|
||||||
|
.div-backends {
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% if backends == 'Cannot get backends' %}
|
||||||
|
{{backends}}
|
||||||
|
{% else %}
|
||||||
|
{% for b in backends %}
|
||||||
|
<a href="/app/sections.py?serv={{ serv}}§ion={{b}}" title="Edit backend {{b}}" target="_blank" style="padding-right: 10px;">
|
||||||
|
{{b}}
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
|
@ -1,26 +1,24 @@
|
||||||
{% for service in service_status %}
|
{% for service in service_status %}
|
||||||
<tr class="{{ loop.cycle('odd', 'even') }}">
|
<td class="padding10 first-collumn">
|
||||||
<td class="padding10 first-collumn">
|
<a href="/app/hapservers.py?serv={{ service.1 }}" title="{{service.0 }}'s overview" class="logs_link">
|
||||||
<a href="/app/hapservers.py?serv={{ service.1 }}" title="{{service.0 }}'s overview" class="logs_link">
|
{{ service.0 }}
|
||||||
{{ service.0 }}
|
</a>
|
||||||
</a>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
{% if service.2|int() >= 1 %}
|
||||||
{% if service.2|int() >= 1 %}
|
<span class="serverUp server-status" title="running {{service.2 }} processes" style="margin-left: 25px !important;"></span>
|
||||||
<span class="serverUp server-status" title="running {{service.2 }} processes" style="margin-left: 25px !important;"></span>
|
{% else %}
|
||||||
{% else %}
|
<span class="serverDown server-status" style="margin-left: 25px !important;"></span>
|
||||||
<span class="serverDown server-status" style="margin-left: 25px !important;"></span>
|
{% endif %}
|
||||||
{% endif %}
|
</td>
|
||||||
</td>
|
<td class="third-collumn-wi">
|
||||||
<td class="third-collumn-wi">
|
{% if service.5.0|length() == 0 %}
|
||||||
{% if service.5.0|length() == 0 %}
|
<span class="serverNone server-status" title="WAF is not installed" style="margin-left: 4px !important;"></span>
|
||||||
<span class="serverNone server-status" title="WAF is not installed" style="margin-left: 4px !important;"></span>
|
{% elif service.5.0 != '' and service.4|int() == 0 %}
|
||||||
{% elif service.5.0 != '' and service.4|int() == 0 %}
|
<span class="serverDown server-status" title="WAF down" style="margin-left: 4px !important;"></span>
|
||||||
<span class="serverDown server-status" title="WAF down" style="margin-left: 4px !important;"></span>
|
{% elif service.5.0 != '' and service.4|int() >= 1 %}
|
||||||
{% elif service.5.0 != '' and service.4|int() >= 1 %}
|
<span class="serverUp server-status" title="running {{service.4 }} processes" style="margin-left: 4px !important;"></span>
|
||||||
<span class="serverUp server-status" title="running {{service.4 }} processes" style="margin-left: 4px !important;"></span>
|
{% endif %}
|
||||||
{% endif %}
|
</td>
|
||||||
</td>
|
<td></td>
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<script src="/inc/overview.js"></script>
|
||||||
{% if serv %}
|
{% if serv %}
|
||||||
<style>
|
<style>
|
||||||
@media (max-width: 1280px) {
|
@media (max-width: 1280px) {
|
||||||
|
@ -9,8 +10,23 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<style>
|
||||||
|
.alert-danger {
|
||||||
|
width: 250px;
|
||||||
|
padding: 5px;
|
||||||
|
margin-bottom: -20px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<div id="up-pannel">
|
<div id="up-pannel">
|
||||||
{% for s in servers %}
|
{% for s in servers %}
|
||||||
|
<script>
|
||||||
|
var ip = []
|
||||||
|
var hostnamea = []
|
||||||
|
{% for s in servers %}
|
||||||
|
ip.push("{{s[2]}}")
|
||||||
|
hostnamea.push("{{s[1]}}")
|
||||||
|
{% endfor %}
|
||||||
|
</script>
|
||||||
{% if serv %}
|
{% if serv %}
|
||||||
<link href="/inc/chart.min.css" rel="stylesheet">
|
<link href="/inc/chart.min.css" rel="stylesheet">
|
||||||
<script src="/inc/metrics.js"></script>
|
<script src="/inc/metrics.js"></script>
|
||||||
|
@ -69,16 +85,9 @@
|
||||||
{{s.5.0.0}} {{s.5.0.1}} {{s.5.0.2}}
|
{{s.5.0.0}} {{s.5.0.1}} {{s.5.0.2}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br />
|
<br />
|
||||||
<span title="Date of last edit config">
|
<span title="Date of last edit config" >
|
||||||
{% if s.7 != None %}
|
Last edit:
|
||||||
{% if "ls: cannot access" in s.7 %}
|
<span id="{{s.1}}"></span>
|
||||||
Cannot find HAProxy config
|
|
||||||
{% else %}
|
|
||||||
Last edit: {{s.7}}
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
Cannot connect to HAProxy server
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
IP: {{s.2}}
|
IP: {{s.2}}
|
||||||
|
@ -97,20 +106,12 @@
|
||||||
|
|
||||||
<div id="ajax-server-{{s.0}}" class="ajax-server"></div>
|
<div id="ajax-server-{{s.0}}" class="ajax-server"></div>
|
||||||
{% if serv %}
|
{% if serv %}
|
||||||
{% if s.8 is defined %}
|
|
||||||
<div class="div-server div-backends">
|
<div class="div-server div-backends">
|
||||||
<div class="server-name">
|
<div class="server-name">
|
||||||
Backends:
|
Backends:
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 10px;">
|
<div style="margin-top: 10px;" id="top-{{s.1}}"></div>
|
||||||
{% for b in s.8 %}
|
|
||||||
<a href="/app/sections.py?serv={{ s.2 }}§ion={{b}}" title="Edit backend {{b}}" target="_blank" style="padding-right: 10px;">
|
|
||||||
{{b}}
|
|
||||||
</a>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -131,5 +132,10 @@
|
||||||
<div id="dialog-confirm" style="display: none;">
|
<div id="dialog-confirm" style="display: none;">
|
||||||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
|
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
|
||||||
</div>
|
</div>
|
||||||
<script src="/inc/overview.js"></script>
|
<script>
|
||||||
|
{% if serv %}
|
||||||
|
overviewHapserverBackends(ip, hostnamea);
|
||||||
|
{% endif %}
|
||||||
|
showHapservers(ip, hostnamea);
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,7 +1,14 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<script src="/inc/overview.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$("#secIntervals").css("display", "none");
|
$("#secIntervals").css("display", "none");
|
||||||
|
var ip = []
|
||||||
|
var hostnamea = []
|
||||||
|
{% for s in servers %}
|
||||||
|
ip.push("{{s[2]}}")
|
||||||
|
hostnamea.push("{{s[1]}}")
|
||||||
|
{% endfor %}
|
||||||
</script>
|
</script>
|
||||||
<table class="overview-wi">
|
<table class="overview-wi">
|
||||||
<tr class="overviewHead">
|
<tr class="overviewHead">
|
||||||
|
@ -19,10 +26,12 @@
|
||||||
</a>
|
</a>
|
||||||
</td class="padding10">
|
</td class="padding10">
|
||||||
<td>
|
<td>
|
||||||
<a onclick="showOverview()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a>
|
<a onclick="showOverview(ip, hostnamea)" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="hostname" class="icon"></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tbody id="ajaxstatus"></tbody>
|
{% for s in servers %}
|
||||||
|
<tr class="{{ loop.cycle('odd', 'even') }}" id="{{s[1]}}"></tr>
|
||||||
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<table class="overview-wi" style="height: 170;">
|
<table class="overview-wi" style="height: 170;">
|
||||||
<tr class="overviewHead" style="height: 40px;">
|
<tr class="overviewHead" style="height: 40px;">
|
||||||
|
@ -283,7 +292,7 @@
|
||||||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
|
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
window.onload = showOverview()
|
showOverview(ip, hostnamea)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
115
inc/overview.js
115
inc/overview.js
|
@ -1,5 +1,118 @@
|
||||||
var cur_url = window.location.href.split('/').pop();
|
var cur_url = window.location.href.split('/').pop();
|
||||||
cur_url = cur_url.split('?');
|
cur_url = cur_url.split('?');
|
||||||
|
function showOverviewHapWI() {
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
act: "overviewHapwi",
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
beforeSend: function() {
|
||||||
|
$('#ajaxHapwi').html('<img class="loading_hapwi_overview" src="/inc/images/loading.gif" />')
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
$("#ajaxHapwi").html(data);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
function showHapservers(serv, hostnamea) {
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < serv.length; i++) {
|
||||||
|
showHapserversCallBack(serv[i], hostnamea[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showHapserversCallBack(serv, hostnamea) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
act: "overviewHapservers",
|
||||||
|
serv: serv,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
beforeSend: function() {
|
||||||
|
$("#"+hostnamea).html('<img class="loading_small_haproxyservers" src="/inc/images/loading.gif" />');
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
$("#"+hostnamea).empty();
|
||||||
|
$("#"+hostnamea).html(data);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
function overviewHapserverBackends(serv, hostnamea) {
|
||||||
|
console.log("#top-"+hostnamea)
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
act: "overviewHapserverBackends",
|
||||||
|
serv: serv[0],
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
beforeSend: function() {
|
||||||
|
$("#top-"+hostnamea).html('<img class="loading_small" style="padding-left: 45%;" src="/inc/images/loading.gif" />');
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
$("#top-"+hostnamea).empty();
|
||||||
|
$("#top-"+hostnamea).html(data);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
function showOverview(serv, hostnamea) {
|
||||||
|
showOverviewHapWI()
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < serv.length; i++) {
|
||||||
|
showOverviewCallBack(serv[i], hostnamea[i])
|
||||||
|
}
|
||||||
|
$.getScript('/inc/overview.js');
|
||||||
|
}
|
||||||
|
function showOverviewCallBack(serv, hostnamea) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
act: "overview",
|
||||||
|
serv: serv,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
beforeSend: function() {
|
||||||
|
$("#"+hostnamea).html('<img class="loading_small" src="/inc/images/loading.gif" />');
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
$("#"+hostnamea).empty();
|
||||||
|
$("#"+hostnamea).html(data);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
function showOverviewServer(name,ip,id) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
act: "overviewServers",
|
||||||
|
name: name,
|
||||||
|
serv: ip,
|
||||||
|
id: id,
|
||||||
|
page: 'hapservers.py',
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
$("#ajax-server-"+id).empty();
|
||||||
|
$("#ajax-server-"+id).css('display', 'block');
|
||||||
|
$("#ajax-server-"+id).css('background-color', '#fbfbfb');
|
||||||
|
$("#ajax-server-"+id).css('border', '1px solid #A4C7F5');
|
||||||
|
$(".ajax-server").css('display', 'block');
|
||||||
|
$(".div-server").css('clear', 'both');
|
||||||
|
$(".div-pannel").css('clear', 'both');
|
||||||
|
$(".div-pannel").css('display', 'block');
|
||||||
|
$(".div-pannel").css('padding-top', '10px');
|
||||||
|
$(".div-pannel").css('height', '70px');
|
||||||
|
$("#div-pannel-"+id).insertBefore('#up-pannel')
|
||||||
|
$("#ajax-server-"+id).html(data);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
function ajaxActionServers(action, id) {
|
function ajaxActionServers(action, id) {
|
||||||
var bad_ans = 'Bad config, check please';
|
var bad_ans = 'Bad config, check please';
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
|
@ -17,7 +130,7 @@ function ajaxActionServers(action, id) {
|
||||||
if (cur_url[0] == "hapservers.py") {
|
if (cur_url[0] == "hapservers.py") {
|
||||||
location.reload()
|
location.reload()
|
||||||
} else {
|
} else {
|
||||||
setTimeout(showOverview, 2000)
|
setTimeout(showOverview(ip, hostnamea), 2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -135,7 +135,7 @@ function startSetInterval(interval) {
|
||||||
interval = 60000;
|
interval = 60000;
|
||||||
}
|
}
|
||||||
intervalId = setInterval('showOverview()', interval);
|
intervalId = setInterval('showOverview()', interval);
|
||||||
showOverview();
|
showOverview(ip, hostnamea);
|
||||||
} else if (cur_url[0] == "viewlogs.py") {
|
} else if (cur_url[0] == "viewlogs.py") {
|
||||||
intervalId = setInterval('viewLogs()', interval);
|
intervalId = setInterval('viewLogs()', interval);
|
||||||
viewLogs();
|
viewLogs();
|
||||||
|
@ -192,53 +192,6 @@ $( document ).ajaxComplete(function( event, request, settings ) {
|
||||||
$('#cover').fadeOut('fast');
|
$('#cover').fadeOut('fast');
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
});
|
});
|
||||||
function showOverview() {
|
|
||||||
showOverviewHapWI()
|
|
||||||
$.ajax( {
|
|
||||||
url: "options.py",
|
|
||||||
data: {
|
|
||||||
act: "overview",
|
|
||||||
token: $('#token').val()
|
|
||||||
},
|
|
||||||
beforeSend: function() {
|
|
||||||
$('#ajaxstatus').html('<img class="loading" src="/inc/images/loading.gif" />')
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
success: function( data ) {
|
|
||||||
$("#ajaxstatus").empty();
|
|
||||||
$("#ajaxstatus").html(data);
|
|
||||||
$.getScript('/inc/overview.js');
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
function showOverviewServer(name,ip,id) {
|
|
||||||
$.ajax( {
|
|
||||||
url: "options.py",
|
|
||||||
data: {
|
|
||||||
act: "overviewServers",
|
|
||||||
name: name,
|
|
||||||
serv: ip,
|
|
||||||
id: id,
|
|
||||||
page: 'hapservers.py',
|
|
||||||
token: $('#token').val()
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
success: function( data ) {
|
|
||||||
$("#ajax-server-"+id).empty();
|
|
||||||
$("#ajax-server-"+id).css('display', 'block');
|
|
||||||
$("#ajax-server-"+id).css('background-color', '#fbfbfb');
|
|
||||||
$("#ajax-server-"+id).css('border', '1px solid #A4C7F5');
|
|
||||||
$(".ajax-server").css('display', 'block');
|
|
||||||
$(".div-server").css('clear', 'both');
|
|
||||||
$(".div-pannel").css('clear', 'both');
|
|
||||||
$(".div-pannel").css('display', 'block');
|
|
||||||
$(".div-pannel").css('padding-top', '10px');
|
|
||||||
$(".div-pannel").css('height', '70px');
|
|
||||||
$("#div-pannel-"+id).insertBefore('#up-pannel')
|
|
||||||
$("#ajax-server-"+id).html(data);
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
function showOverviewWaf() {
|
function showOverviewWaf() {
|
||||||
if (cur_url[0] == "waf.py") {
|
if (cur_url[0] == "waf.py") {
|
||||||
$.getScript('/inc/chart.min.js');
|
$.getScript('/inc/chart.min.js');
|
||||||
|
@ -274,22 +227,6 @@ function showOverviewWaf() {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function showOverviewHapWI() {
|
|
||||||
$.ajax( {
|
|
||||||
url: "options.py",
|
|
||||||
data: {
|
|
||||||
act: "overviewHapwi",
|
|
||||||
token: $('#token').val()
|
|
||||||
},
|
|
||||||
beforeSend: function() {
|
|
||||||
$('#ajaxHapwi').html('<img class="loading_hapwi_overview" src="/inc/images/loading.gif" />')
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
success: function( data ) {
|
|
||||||
$("#ajaxHapwi").html(data);
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
function showStats() {
|
function showStats() {
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
|
@ -516,6 +453,9 @@ function viewLogs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$( function() {
|
$( function() {
|
||||||
|
$('#errorMess').click(function(){
|
||||||
|
$('#error').remove();
|
||||||
|
});
|
||||||
$( "#serv" ).on('selectmenuchange',function() {
|
$( "#serv" ).on('selectmenuchange',function() {
|
||||||
$("#show").css("pointer-events", "inherit");
|
$("#show").css("pointer-events", "inherit");
|
||||||
$("#show").css("cursor", "pointer");
|
$("#show").css("cursor", "pointer");
|
||||||
|
|
|
@ -744,6 +744,7 @@ label {
|
||||||
.div-server {
|
.div-server {
|
||||||
background-color: #fbfbfb;
|
background-color: #fbfbfb;
|
||||||
border: 1px solid #A4C7F5;
|
border: 1px solid #A4C7F5;
|
||||||
|
height: 153px;
|
||||||
width: 365px;
|
width: 365px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
|
@ -780,7 +781,7 @@ label {
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
color: #999;
|
color: #999;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
min-height: 60px;
|
height: 80px;
|
||||||
}
|
}
|
||||||
.server-act-links {
|
.server-act-links {
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
|
@ -1027,6 +1028,15 @@ label {
|
||||||
.loading_hapwi_overview{
|
.loading_hapwi_overview{
|
||||||
margin-left: 40%;
|
margin-left: 40%;
|
||||||
}
|
}
|
||||||
|
.loading_small {
|
||||||
|
width: 39px;
|
||||||
|
height: 39px;
|
||||||
|
padding-left: 103%;
|
||||||
|
}
|
||||||
|
.loading_small_haproxyservers {
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
}
|
||||||
.tooltip {
|
.tooltip {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
|
|
|
@ -2,9 +2,7 @@ configparser==3.5.0
|
||||||
paramiko>=2.5.0
|
paramiko>=2.5.0
|
||||||
pytz==2017.3
|
pytz==2017.3
|
||||||
requests>=2.22.0
|
requests>=2.22.0
|
||||||
requests_toolbelt==0.8.0
|
|
||||||
pyTelegramBotAPI==3.6.3
|
pyTelegramBotAPI==3.6.3
|
||||||
dump==0.0.4
|
|
||||||
networkx==2.1
|
networkx==2.1
|
||||||
matplotlib==2.1.2
|
matplotlib==2.1.2
|
||||||
future==0.13.1
|
future==0.13.1
|
||||||
|
|
Loading…
Reference in New Issue