Include links to manuals
pull/161/head
Pavel Loginov 2019-10-02 09:35:34 +03:00
parent 7edd6f179e
commit c2ea422e82
10 changed files with 77 additions and 88 deletions

View File

@ -8,6 +8,9 @@ Support the project
# Youtube
[Demo video](https://www.youtube.com/channel/UCo0lCg24j-H4f0S9kMjp-_w)
# Twitter
[Twitter](https://twitter.com/haproxy_wi), subscribe! I will write there about all the changes and news
# Demo site
[Demo site](https://demo.haproxy-wi.org) Login/password: admin/admin. Server resets every hour.

View File

@ -420,7 +420,7 @@ def update_db_v_3_4_9_5(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
sql = """update version set version = '3.4.9.5'; """
sql = """update version set version = '3.4.9.6'; """
try:
cur.execute(sql)
con.commit()

View File

@ -15,7 +15,6 @@ server_status = ()
async def async_get_overview(serv1, serv2):
haproxy_config_path = sql.get_setting('haproxy_config_path')
commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
# commands1 = [ "ps ax |grep waf/bin/modsecurity |grep -v grep |wc -l" ]
commands2 = "ps ax |grep keep_alive.py |grep -v grep |wc -l"
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Process_num"' % (serv2, haproxy_sock_port)
@ -66,23 +65,22 @@ def get_overviewWaf(url):
ioloop.run_until_complete(get_runner_overviewWaf(url))
ioloop.close()
async def async_get_overviewServers(serv1, serv2, desc):
# commands = [ "top -u haproxy -b -n 1" ]
# commands = [ "top -u haproxy -b -n 1 -o %MEM |grep -e 'haproxy\|PID' |awk '{print $1\"\t\"$5\"\t\"$9\"\t\"$10\"\t\"$11}'" ]
async def async_get_overviewServers(serv1, serv2):
commands = [ "top -u haproxy -b -n 1 -w 67 |grep -e 'haproxy\|PID\|Cpu\|KiB' |grep -v Swap" ]
if desc == "hapservers.py":
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|Maxco\|MB\|Uptime:"' % (serv2, haproxy_sock_port)
else:
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|SessRate\|Maxco\|MB\|Uptime:"' % (serv2, haproxy_sock_port)
# if desc == "hapservers.py":
# cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|Maxco\|MB\|Uptime:"' % (serv2, haproxy_sock_port)
# else:
# cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|SessRate\|Maxco\|MB\|Uptime:"' % (serv2, haproxy_sock_port)
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|Maxco\|MB\|Uptime:"' % (serv2, haproxy_sock_port)
out = funct.subprocess_execute(cmd)
out1 = ""
user_id = cookie.get('uuid')
role = sql.get_user_role_by_uuid(user_id.value)
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
cfg = hap_configs_dir + serv2 + "-" + funct.get_data('config') + ".cfg"
funct.get_config(serv2, cfg)
backends = funct.get_sections(cfg)
os.system("/bin/rm -f " + cfg)
# user_id = cookie.get('uuid')
# role = sql.get_user_role_by_uuid(user_id.value)
# hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
# cfg = hap_configs_dir + serv2 + "-" + funct.get_data('config') + ".cfg"
# funct.get_config(serv2, cfg)
# backends = funct.get_sections(cfg)
# os.system("/bin/rm -f " + cfg)
for k in out:
if "Ncat: Connection refused." not in k and "Ncat: Connection timed out." not in k:
@ -92,26 +90,26 @@ async def async_get_overviewServers(serv1, serv2, desc):
else:
out1 = "Can\'t connect to HAproxy"
if role <= 2:
server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands),backends, desc)
else:
server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands),funct.show_backends(serv2, ret=1), desc)
# if role <= 2:
# server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands),backends, desc)
# else:
# server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands),funct.show_backends(serv2, ret=1), desc)
server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands))
return server_status
async def get_runner_overviewServers(**kwargs):
template = env.get_template('overviewServers.html')
user_id = cookie.get('uuid')
role = sql.get_user_role_by_uuid(user_id.value)
if kwargs.get('server1'):
futures = [async_get_overviewServers(kwargs.get('server1'), kwargs.get('server2'), 'hapservers.py')]
else:
futures = [async_get_overviewServers(server[1], server[2], server[11]) for server in listhap]
# if kwargs.get('server1'):
futures = [async_get_overviewServers(kwargs.get('server1'), kwargs.get('server2'))]
# else:
# futures = [async_get_overviewServers(server[1], server[2], server[11]) for server in listhap]
for i, future in enumerate(asyncio.as_completed(futures)):
result = await future
servers.append(result)
servers_sorted = sorted(servers, key=funct.get_key)
template = template.render(service_status=servers_sorted, role=role,page=kwargs.get('page'))
template = template.render(service_status=servers_sorted, role=role)
print(template)
def get_overviewServers(**kwargs):
@ -119,7 +117,7 @@ def get_overviewServers(**kwargs):
server2 = kwargs.get('ip')
page = kwargs.get('page')
ioloop = asyncio.get_event_loop()
ioloop.run_until_complete(get_runner_overviewServers(server1=server1, server2=server2,page=page))
ioloop.run_until_complete(get_runner_overviewServers(server1=server1, server2=server2))
ioloop.close()
def get_map(serv):

View File

@ -320,14 +320,14 @@
<table id="ssh_enable_table" class="overview">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 15%;">
<span title="It's just name alias. This alias will be userd in 'Servers' page for choose credentials">Name(?)</span>
<span title="It's just name alias. This alias will be use in 'Servers' page for choose credentials">Name<span>
</td>
<td class="padding10 first-collumn" style="width: 25%;">
<span title="If enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH key(?)</span>
<span title="If it is enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH key</span>
</td>
<td>Group</td>
<td>
<span title="Enter SSH user name. If SSH key disabled, enter password for ssh user">Credentials(?)</span>
<span title="Enter SSH user name. If SSH key disabled, enter password for ssh user">Credentials</span>
</td>
<td></td>
</tr>
@ -411,7 +411,7 @@
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">Upload SSH Key</td>
<td>
<span title="Private key. Note: The public key must be pre-installed on all servers to which you plan to connect">Key(?)</span>
<span title="Private key. Note: The public key must be pre-installed on all servers to which you plan to connect">Key</span>
</td>
<td></td>
</tr>
@ -432,15 +432,18 @@
</tr>
</table>
<div id="ajax-ssh"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=creds" title="Servers description" target="_blank">here</a>
</div>
</div>
<div id="checker">
<table id="checker_table" class="overview">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that gave you @father_bot">Token(?)</span>
<span title="Token that gave you @father_bot">Token</span>
</td>
<td>Chanel name</td>
<td>Channel name</td>
<td>Group</td>
<td></td>
<td></td>
@ -479,7 +482,7 @@
<table class="overview" id="telegram-add-table" style="display: none;">
<tr class="overviewHead">
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that gave you @father_bot">Token(?)</span>
<span title="Token that gave you @father_bot">Token</span>
</td>
<td>Chanel name</td>
<td>Group</td>
@ -506,6 +509,9 @@
</tr>
</table>
<div id="ajax-telegram"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=checker" title="Servers description" target="_blank">here</a>
</div>
</div>
</div>
<div id="user-add-table" style="display: none;">

View File

@ -1,46 +1,12 @@
{% for service in service_status %}
<div class="server-info">
{% if page != 'hapservers.py' %}
<a name="{{ service.0 }}"></a>
{% if service.5 != "None" %}
<h4 title="IP {{ service.1 }} {{ service.5 }}"> {{ service.0 }} :</h4>
{% else %}
<h4 title="IP {{ service.1 }}"> {{ service.0 }} :</h4>
{% endif %}
{% endif %}
<div class="haproxy-info">
{{ service.2 }}
</div>
<div class="top-info">
<pre>
<div class="haproxy-info">
{{ service.2 }}
</div>
<div class="top-info">
<pre>
{{ service.3 }}
</pre>
</div>
{% if page != 'hapservers.py' %}
<span style="padding-left: 0px; margin: 0;">
{% if 'Unknown command' in service.4 %}
Too old version HAProxy
{% else %}
{% for s in service.4 %}
{% if role <= 2 %}
<a href="/app/sections.py?serv={{service.1}}&section={{ s }}" title="Edit {{s}} section" target="_blanck">
{{s}}
</a>
{% else %}
{{ s }}
{% endif %}
<br />
{% endfor %}
{% endif %}
</span>
{% endif %}
</pre>
</div>
</div>
{% endfor %}

View File

@ -73,10 +73,16 @@
<script>
viewLogs()
</script>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the descriptions about all logs <a href="https://haproxy-wi.org/description.py?description=logs" title="Servers description" target="_blank">here</a>
</div>
{% elif serv == 'haproxy-wi.error.log' or serv == 'haproxy-wi.access.log' %}
<script>
showApacheLog('{{serv}}');
</script>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description about all logs file <a href="https://haproxy-wi.org/description.py?description=logs" title="Servers description" target="_blank">here</a>
</div>
{% else %}
<script>
showLog()

View File

@ -4,8 +4,8 @@
<tr class="overviewHead">
<td class="padding10 first-collumn">Server</td>
<td>Disable/Enable server or output any information</td>
<td class="padding10">Command</td>
<td>Save change</td>
<td>Command</td>
<td class="checkbox-head">Save change</td>
<td></td>
</tr>
<tr>
@ -36,7 +36,7 @@
<td>
<input type="text" name="servbackend" id="servbackend" size=35 title="Frontend, backend/server, show: info, pools or help" required class="form-control" value="{{ servbackend }}">
</td>
<td>
<td class="checkbox">
{% if role <= 2 %}
<label for="save"></label><input type="checkbox" name="save" id="save" value="123">
{% endif %}
@ -52,4 +52,8 @@
window.onload = {{ onclick }}
}
</script>
<div id="ajaxruntime"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all Run Time API <a href="https://haproxy-wi.org/description.py?description=runtimeapi" title="Servers description" target="_blank">here</a>
</div>
{% endblock %}

View File

@ -104,7 +104,7 @@
<td class="checkbox-head"><span title="Keep start HAProxy service if down">Start</span></td>
<td class="slave-field"><span title="Actions with master config will automatically apply on slave">Slave for</span></td>
<td class="cred-field">Credentials</td>
<td>Desciption</td>
<td>Description</td>
<td></td>
<td></td>
</tr>
@ -211,13 +211,13 @@
<table id="ssh_enable_table" class="overview">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 15%;">
<span title="It's just name alias. This alias will be userd in 'Servers' page for choose credentials">Name(?)</span>
<span title="It's just name alias. This alias will be userd in 'Servers' page for choose credentials">Name</span>
</td>
<td class="padding10 first-collumn" style="width: 25%;">
<span title="If enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH key(?)</span>
<span title="If enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH key</span>
</td>
<td>
<span title="Enter SSH user name. If SSH key disabled, enter password for ssh user">Credentials(?)</span>
<span title="Enter SSH user name. If SSH key disabled, enter password for ssh user">Credentials</span>
</td>
<td></td>
</tr>
@ -284,7 +284,7 @@
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">Upload SSH Key</td>
<td>
<span title="Private key. Note: The public key must be pre-installed on all servers to which you plan to connect">Key(?)</span>
<span title="Private key. Note: The public key must be pre-installed on all servers to which you plan to connect">Key</span>
</td>
<td></td>
</tr>
@ -307,13 +307,16 @@
</tr>
</table>
<div id="ajax-ssh"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=creds" title="Servers description" target="_blank">here</a>
</div>
</div>
<div id="checker">
<table id="checker_table" class="overview">
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that gave you @father_bot">Token(?)</span>
<span title="Token that gave you @father_bot">Token</span>
</td>
<td>Chanel name</td>
<td></td>
@ -339,10 +342,10 @@
<table class="overview" id="telegram-add-table" style="display: none;">
<tr class="overviewHead">
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that gave you @father_bot">Token(?)</span>
<span title="Token that gave you @father_bot">Token</span>
</td>
<td>
Chanel name
Channel name
</td>
<td></td>
</tr>
@ -362,6 +365,9 @@
</tr>
</table>
<div id="ajax-telegram"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=checker" title="Servers description" target="_blank">here</a>
</div>
</div>
</div>
<div id="group_error" style="display: none;">

View File

@ -70,7 +70,7 @@ selects.append(['haproxy-wi.error.log','error.log'])
selects.append(['haproxy-wi.access.log','access.log'])
output_from_parsed_template = template.render(h2 = 1,
autorefresh = 1,
title = "View logs",
title = "View internal logs",
role = sql.get_user_role_by_uuid(user_id.value),
user = user,
onclick = "viewLogs()",

View File

@ -379,7 +379,7 @@ function showRuntime() {
},
type: "GET",
success: function( data ) {
$("#ajax").html(data);
$("#ajaxruntime").html(data);
}
} );
}