The "Overview" pages are improved
pull/161/head
Pavel Loginov 2019-10-14 09:55:29 +03:00
parent ca922d983a
commit 9c749a0eb2
18 changed files with 128 additions and 192 deletions

View File

@ -440,7 +440,7 @@ def update_db_v_3_5_3(**kwargs):
def update_ver(**kwargs): def update_ver(**kwargs):
con, cur = get_cur() con, cur = get_cur()
sql = """update version set version = '3.5.4'; """ sql = """update version set version = '3.5.5'; """
try: try:
cur.execute(sql) cur.execute(sql)
con.commit() con.commit()

View File

@ -17,11 +17,14 @@ try:
groups = sql.select_groups() groups = sql.select_groups()
token = sql.get_token(user_id.value) token = sql.get_token(user_id.value)
servers = sql.get_dick_permit() servers = sql.get_dick_permit()
cmd = "ps ax |grep -e 'keep_alive.py' |grep -v grep |wc -l"
keep_alive, stderr = funct.subprocess_execute(cmd)
except: except:
pass pass
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:
@ -40,12 +43,17 @@ for s in servers:
else: else:
out1 = False out1 = False
servers_with_status.append(out1) servers_with_status.append(out1)
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')
servers_with_status1.append(servers_with_status) servers_with_status1.append(servers_with_status)
template = template.render(h2 = 1, template = template.render(h2 = 1,
autorefresh = 1, autorefresh = 0,
title = "HAProxy servers overview", title = "HAProxy servers overview",
role = sql.get_user_role_by_uuid(user_id.value), role = sql.get_user_role_by_uuid(user_id.value),
user = user, user = user,
@ -53,5 +61,6 @@ template = template.render(h2 = 1,
groups = groups, groups = groups,
servers = servers_with_status1, servers = servers_with_status1,
versions = funct.versions(), versions = funct.versions(),
keep_alive = ''.join(keep_alive),
token = token) token = token)
print(template) print(template)

View File

@ -24,7 +24,7 @@ if act == "checkrestart":
sys.exit() sys.exit()
if not sql.check_token_exists(form.getvalue('token')): if not sql.check_token_exists(form.getvalue('token')):
print("What the fuck?! U r hacker Oo?!") print("Your token has been expired")
sys.exit() sys.exit()
if form.getvalue('getcerts') is not None and serv is not None: if form.getvalue('getcerts') is not None and serv is not None:
@ -140,7 +140,7 @@ if act == "overviewwaf":
if act == "overviewServers": if act == "overviewServers":
id = form.getvalue('id') id = form.getvalue('id')
name = form.getvalue('name') name = form.getvalue('name')
ovw.get_overviewServers(ip=serv,name=name,page=form.getvalue('page')) ovw.get_overviewServers(ip=serv,name=name,id=form.getvalue('id'))
if act == "overviewHapwi": if act == "overviewHapwi":

View File

@ -13,17 +13,18 @@ servers = []
server_status = () server_status = ()
async def async_get_overview(serv1, serv2): async def async_get_overview(serv1, serv2):
haproxy_config_path = sql.get_setting('haproxy_config_path') # haproxy_config_path = sql.get_setting('haproxy_config_path')
commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ] # commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
commands2 = "ps ax |grep keep_alive.py |grep -v grep |wc -l" commands2 = [ "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) cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Process_num"' % (serv2, haproxy_sock_port)
server_status = (serv1, server_status = (serv1,
serv2, serv2,
funct.server_status(funct.subprocess_execute(cmd)), funct.server_status(funct.subprocess_execute(cmd)),
funct.ssh_command(serv2, commands),
sql.select_servers(server=serv2, keep_alive=1), sql.select_servers(server=serv2, keep_alive=1),
funct.subprocess_execute(commands2)) funct.ssh_command(serv2, commands2),
sql.select_waf_servers(serv2))
return server_status return server_status
async def get_runner_overview(): async def get_runner_overview():
@ -67,20 +68,9 @@ def get_overviewWaf(url):
async def async_get_overviewServers(serv1, serv2): 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" ] 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)
cmd = 'echo "show info" |nc %s %s -w 1|grep -e "Ver\|CurrConns\|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) out = funct.subprocess_execute(cmd)
out1 = "" 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)
for k in out: for k in out:
if "Ncat:" not in k: if "Ncat:" not in k:
@ -90,10 +80,6 @@ async def async_get_overviewServers(serv1, serv2):
else: else:
out1 = "Can\'t connect to HAproxy" 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)
server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands)) server_status = (serv1,serv2, out1, funct.ssh_command(serv2, commands))
return server_status return server_status
@ -101,23 +87,21 @@ async def get_runner_overviewServers(**kwargs):
template = env.get_template('overviewServers.html') template = env.get_template('overviewServers.html')
user_id = cookie.get('uuid') user_id = cookie.get('uuid')
role = sql.get_user_role_by_uuid(user_id.value) role = sql.get_user_role_by_uuid(user_id.value)
# if kwargs.get('server1'):
futures = [async_get_overviewServers(kwargs.get('server1'), kwargs.get('server2'))] 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)): for i, future in enumerate(asyncio.as_completed(futures)):
result = await future result = await future
servers.append(result) servers.append(result)
servers_sorted = sorted(servers, key=funct.get_key) servers_sorted = sorted(servers, key=funct.get_key)
template = template.render(service_status=servers_sorted, role=role) template = template.render(service_status=servers_sorted, role=role, id=kwargs.get('id'))
print(template) print(template)
def get_overviewServers(**kwargs): def get_overviewServers(**kwargs):
server1 = kwargs.get('name') server1 = kwargs.get('name')
server2 = kwargs.get('ip') server2 = kwargs.get('ip')
page = kwargs.get('page') id = kwargs.get('id')
ioloop = asyncio.get_event_loop() ioloop = asyncio.get_event_loop()
ioloop.run_until_complete(get_runner_overviewServers(server1=server1, server2=server2)) ioloop.run_until_complete(get_runner_overviewServers(server1=server1, server2=server2, id=id))
ioloop.close() ioloop.close()
def get_map(serv): def get_map(serv):

View File

@ -834,9 +834,9 @@ def select_waf_metrics_enable_server(ip):
cur.close() cur.close()
con.close() con.close()
def select_waf_servers(): def select_waf_servers(serv):
con, cur = create_db.get_cur() con, cur = create_db.get_cur()
sql = """ select serv.ip from waf left join servers as serv on waf.server_id = serv.id where waf.metrics = '1'""" sql = """ select serv.ip from waf left join servers as serv on waf.server_id = serv.id where serv.ip = '%s' """ % serv
try: try:
cur.execute(sql) cur.execute(sql)
except sqltool.Error as e: except sqltool.Error as e:
@ -1400,7 +1400,7 @@ error_mess = '<span class="alert alert-danger" id="error">All fields must be com
def check_token(): def check_token():
if not check_token_exists(form.getvalue('token')): if not check_token_exists(form.getvalue('token')):
print('Content-type: text/html\n') print('Content-type: text/html\n')
print("What the fuck?! U r hacker Oo?!") print("Your token has been expired")
import sys import sys
sys.exit() sys.exit()

View File

@ -15,7 +15,6 @@
<li><a href="#users">Users</a></li> <li><a href="#users">Users</a></li>
<li><a href="#groups">Groups</a></li> <li><a href="#groups">Groups</a></li>
<li><a href="#servers">Servers</a></li> <li><a href="#servers">Servers</a></li>
<!-- <li><a href="#roles">Roles</a></li> -->
<li><a href="#ssh">SSH credentials</a></li> <li><a href="#ssh">SSH credentials</a></li>
<li><a href="#checker">Checker</a></li> <li><a href="#checker">Checker</a></li>
{% if user %} {% if user %}
@ -305,21 +304,6 @@
You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a> You can read the description of all parameters <a href="https://haproxy-wi.org/description.py?description=servers" title="Servers description" target="_blank">here</a>
</div> </div>
</div> </div>
<!-- <div id="roles"> -->
<!-- <table class="overview" id="ajax-group"> -->
<!-- <tr class="overviewHead"> -->
<!-- <td class="padding10 first-collumn">Name</td> -->
<!-- <td>Description</td> -->
<!-- </tr> -->
<!-- <tr> -->
<!-- {% for role in roles %} -->
<!-- <tr id="group-{{role.0}}" class="{{ loop.cycle('odd', 'even') }}"> -->
<!-- <td class="padding10 first-collumn">{{role.1}}</td> -->
<!-- <td>{{role.2}}</td> -->
<!-- </tr> -->
<!-- {% endfor %} -->
<!-- </table> -->
<!-- </div> -->
<div id="ssh"> <div id="ssh">
<table id="ssh_enable_table" class="overview"> <table id="ssh_enable_table" class="overview">

View File

@ -1,7 +1,5 @@
{% set waf_servers = [] %}
{% for service in service_status %} {% for service in service_status %}
{% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" or url == "waf.py" %} {% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" or url == "waf.py" %}
{% do waf_servers.append(1) %}
<tr class="{{ loop.cycle('odd', 'even') }}" id="{{service.0}}-select-line"> <tr class="{{ loop.cycle('odd', 'even') }}" id="{{service.0}}-select-line">
<td class="padding10 first-collumn-wi"> <td class="padding10 first-collumn-wi">
{% if service.2|int() >= 1 %} {% if service.2|int() >= 1 %}
@ -49,7 +47,6 @@
{{ service.3 }} {{ service.3 }}
{% endif %} {% endif %}
</td> </td>
{% if url == "waf.py" %}
<td style="padding-top: 2px;"> <td style="padding-top: 2px;">
{% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" %} {% if service.3 == "On" or service.3 == "Off" or service.3 == "DetectionOnly" %}
{% if service.4|int() == 1 %} {% if service.4|int() == 1 %}
@ -59,18 +56,10 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </td>
{% endif %}
<td></td> <td></td>
</tr> </tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if waf_servers|count == 0 and url != "waf.py" %}
<tr>
<td class="padding10 first-collumn-wi">
You have not installed the WAF server yet
</td>
</tr>
{% endif %}
<script> <script>
$( "select" ).selectmenu(); $( "select" ).selectmenu();
{% if role <= 1 %} {% if role <= 1 %}

View File

@ -1,53 +1,24 @@
{% for service in service_status %} {% for service in service_status %}
<tr class="{{ loop.cycle('odd', 'even') }}"> <tr class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">
{% if service.2|int() >= 1 %}
<span class="serverUp server-status" title="running {{service.2 }} processes"></span>
{% else %}
<span class="serverDown server-status"></span>
{% endif %}
<a href="/app/logs.py?serv={{ service.1 }}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00&waf=0" title="View {{service.0 }}'s logs" class="logs_link"> <a href="/app/logs.py?serv={{ service.1 }}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00&waf=0" title="View {{service.0 }}'s logs" class="logs_link">
{{ service.0 }} {{ service.0 }}
</a> </a>
{% if service.4.0.0|int() >= 1 %}
<img
{% if service.5.0.0|int() >= 1 %}
src="/inc/images/shield.png" title="Auto start enabled"
{% else %}
src="/inc/images/shield-red.png" title="Auto start enabled, but keep alive service does not work"
{% endif %}
width=18 style="padding-left: 5px; margin-bottom: -3px;">
{% endif %}
</td> </td>
<!-- <td class="second-collumn"> -->
<!-- </td> -->
<td> <td>
{% if role <= 1 %} {% if service.2|int() >= 1 %}
<a id="{{ service.1 }}" class="start" title="Start HAProxy service"> <span class="serverUp server-status" title="running {{service.2 }} processes" style="margin-left: 25px !important;"></span>
<img src=/inc/images/start.png alt="start" class="icon" style="margin-bottom: -2px;"> {% else %}
</a> <span class="serverDown server-status" style="margin-left: 25px !important;"></span>
<a id="{{ service.1 }}" class="stop" title="Stop HAProxy service">
<img src=/inc/images/stop.png alt="start" class="icon" width="17px">
</a>
<a id="{{ service.1 }}" class="restart" title="Restart HAProxy service">
<img src=/inc/images/update.png alt="restart" class="icon">
</a>
{% endif %} {% endif %}
{% if role <= 2 %}
<a href="/app/config.py?serv={{ service.1 }}&open=open" target="_blank" title="Working with HAProxy configs">
<img src="/inc/images/edit.png" alt="edit" class="icon" width="15px">
</a>
{% endif %}
<a href="/app/viewsttats.py?serv={{ service.1 }}" target="_blank" title="Show stats">
<img src="/inc/images/show.png" alt="show" class="icon" width="20px" style="margin-bottom: -3px;">
</a>
</td> </td>
<td class="third-collumn-wi"> <td class="third-collumn-wi">
{% if "ls: cannot access" in service.3 %} {% if service.5.0|length() == 0 %}
Cannot find HAProxy config <span class="serverNone server-status" title="WAF is not installed" style="margin-left: 10px !important;"></span>
{% else %} {% elif service.5.0 != '' and service.4|int() == 0 %}
{{ service.3 }} <span class="serverDown server-status" title="WAF down" style="margin-left: 10px !important;"></span>
{% elif service.5.0 != '' and service.4|int() >= 1 %}
<span class="serverUp server-status" title="running {{service.5 }} processes" style="margin-left: 10px !important;"></span>
{% endif %} {% endif %}
</td> </td>
<td></td> <td></td>

View File

@ -8,5 +8,10 @@
{{ service.3 }} {{ service.3 }}
</pre> </pre>
</div> </div>
<div class="update-icon">
<a onclick="showOverviewServer('{{ service.0 }}', '{{ service.1 }}', '{{id}}')" title="Refresh">
<img src="/inc/images/update.png" alt="restart" class="icon">
</a>
</div>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -5,7 +5,6 @@
<div class="div-pannel" id="div-pannel-{{s.0}}"> <div class="div-pannel" id="div-pannel-{{s.0}}">
<div id="div-server-{{s.0}}" class="div-server"> <div id="div-server-{{s.0}}" class="div-server">
<div class="server-name"> <div class="server-name">
{% if s.5 != False %} {% if s.5 != False %}
<span class="serverUp server-status" title="{{s.5.0.2}}"></span> <span class="serverUp server-status" title="{{s.5.0.2}}"></span>
{% else %} {% else %}
@ -14,6 +13,15 @@
<span title="Show info about {{s.2}}" onclick="showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}')" style="cursor: pointer;"> <span title="Show info about {{s.2}}" onclick="showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}')" style="cursor: pointer;">
{{s.1}} {{s.1}}
</span> </span>
{% if s.6|int() >= 1 %}
<img
{% if keep_alive|int() >= 1 %}
src="/inc/images/shield.png" title="Auto start enabled"
{% else %}
src="/inc/images/shield-red.png" title="Auto start enabled, but keep alive service does not work"
{% endif %}
width=18 style="padding-left: 5px; margin-bottom: -3px;">
{% endif %}
{% if role <= 1 %} {% if role <= 1 %}
<span class="server-action"> <span class="server-action">
<a id="{{ s.2 }}" class="start" title="Start HAProxy service"> <a id="{{ s.2 }}" class="start" title="Start HAProxy service">
@ -33,9 +41,17 @@
{% if s.5.0 is defined %} {% if s.5.0 is defined %}
<br /> <br />
{{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 %}
<br />
<span title="Date of last edit config">
{% if "ls: cannot access" in s.7 %}
Cannot find HAProxy config
{% else %}
Last edit: {{s.7}}
{% endif %}
</span>
<br /> <br />
IP: {{s.2}} IP: {{s.2}}
{% endif %}
</div> </div>
<div class="server-act-links"> <div class="server-act-links">
<a href="/app/config.py?serv={{s.2}}&showConfig" class="ui-button ui-widget ui-corner-all" title="Open running config">Open</a> <a href="/app/config.py?serv={{s.2}}&showConfig" class="ui-button ui-widget ui-corner-all" title="Open running config">Open</a>

View File

@ -43,7 +43,7 @@ body, .container {
<input type="hidden" value="{{reff}}" name="ref" id="ref"> <input type="hidden" value="{{reff}}" name="ref" id="ref">
<button type="submit" name="Login" value="Enter" id="enter">Login</button> <button type="submit" name="Login" value="Enter" id="enter">Login</button>
</form> </form>
<div class="alert alert-danger" style="display: none; margin-top: 220px;margin-right: 70px;width: 300px;"> <div class="alert alert-danger" style="display: none; margin-top: 220px;margin-right: -210px;width: 300px;">
Your login or password is incorrect Your login or password is incorrect
<br /> <br />
<span id="ban_10"> <span id="ban_10">

View File

@ -8,11 +8,15 @@
<td class="padding10 first-collumn-wi"> <td class="padding10 first-collumn-wi">
Server Server
</td> </td>
<td class="padding10 third-collumn-wi"> <td class="padding10 third-collumn-wi" style="width: 35%;">
Action <a href="/app/hapservers.py" title="HAProxy servers overview" class="logs_link">
HAProxy
</a>
</td> </td>
<td class="padding10"> <td class="padding10">
Last edit <a href="/app/waf.py" title="WAf servers overview" class="logs_link">
WAF
</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()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a>
@ -20,29 +24,16 @@
</tr> </tr>
<tbody id="ajaxstatus"></tbody> <tbody id="ajaxstatus"></tbody>
</table> </table>
<table class="overview-wi">
<tr class="overviewHead">
<td class="padding10 first-collumn-wi">
WAF
</td class="padding10 second-collumn">
<td class="padding10 third-collumn-wi">
Action
</td>
<td class="padding10">
WAF mode
</td class="padding10">
<td>
<a onclick="showOverviewWaf()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a>
</td>
</tr>
<tbody id="ajaxwafstatus"></tbody>
</table>
<table class="overview-wi" style="height: 170;"> <table class="overview-wi" style="height: 170;">
<tr class="overviewHead"> <tr class="overviewHead">
<td class="padding10 first-collumn-wi"> <td class="padding10 first-collumn-wi">
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs=haproxy-wi-{{date}}.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View HAProxy-WI logs" class="logs_link"> <a href="/app/viewlogs.py?viewlogs=haproxy-wi-{{date}}.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View HAProxy-WI logs" class="logs_link">
HAProxy-WI server status HAProxy-WI server status
</a> </a>
{% else %}
HAProxy-WI server status
{% endif %}
</td> </td>
<td> <td>
<a onclick="showOverviewHapWI()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a> <a onclick="showOverviewHapWI()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a>
@ -55,8 +46,8 @@
</td> </td>
</tr> </tr>
</table> </table>
<table class="overview-wi" style="height: 170;"> <table class="overview-wi" style="height: 165;">
<tr class="overviewHead" style="height: 48px;"> <tr class="overviewHead" style="height: 40px;">
<th class="padding10 first-collumn-wi" colspan=4> <th class="padding10 first-collumn-wi" colspan=4>
Tools status Tools status
</th> </th>
@ -68,9 +59,13 @@
{% else %} {% else %}
<span class="serverDown server-status"></span> <span class="serverDown server-status"></span>
{% endif %} {% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs=metrics-{{date}}.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View metrics master's logs" class="logs_link"> <a href="/app/viewlogs.py?viewlogs=metrics-{{date}}.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View metrics master's logs" class="logs_link">
<span>Metrics master</span> <span>Metrics master</span>
</a> </a>
{% else %}
<span>Metrics master</span>
{% endif %}
</td> </td>
<td class="third-collumn-wi"> <td class="third-collumn-wi">
{% if checker_master|int() >= 1 %} {% if checker_master|int() >= 1 %}
@ -78,9 +73,13 @@
{% else %} {% else %}
<span class="serverDown server-status"></span> <span class="serverDown server-status"></span>
{% endif %} {% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs=checker-{{date}}.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker master's logs" class="logs_link"> <a href="/app/viewlogs.py?viewlogs=checker-{{date}}.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker master's logs" class="logs_link">
<span>Checker master</span> <span>Checker master</span>
</a> </a>
{% else %}
<span>Checker master</span>
{% endif %}
</td> </td>
<td class="third-collumn-wi"> <td class="third-collumn-wi">
{% if keep_alive|int() >= 1 %} {% if keep_alive|int() >= 1 %}
@ -88,9 +87,13 @@
{% else %} {% else %}
<span class="serverDown server-status"></span> <span class="serverDown server-status"></span>
{% endif %} {% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs=keep_alive.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View keep alive logs" class="logs_link"> <a href="/app/viewlogs.py?viewlogs=keep_alive.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View keep alive logs" class="logs_link">
<span>Keep alive</span> <span>Keep alive</span>
</a> </a>
{% else %}
<span>Keep alive</span>
{% endif %}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -100,9 +103,13 @@
{% else %} {% else %}
<span title="running {{metrics_worker}} worker processes"><span class="serverDown server-status"></span> <span title="running {{metrics_worker}} worker processes"><span class="serverDown server-status"></span>
{% endif %} {% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs=metrics-error.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View worker's logs" class="logs_link"> <a href="/app/viewlogs.py?viewlogs=metrics-error.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View worker's logs" class="logs_link">
<span>Metrics workers</span> <span>Metrics workers</span>
</a> </a>
{% else %}
<span>Metrics workers</span>
{% endif %}
</td> </td>
<td> <td>
{% if checker_worker|int() >= 1 %} {% if checker_worker|int() >= 1 %}
@ -110,9 +117,13 @@
{% else %} {% else %}
<span title="running {{ checker_worker }} worker processes"><span class="serverDown server-status"></span> <span title="running {{ checker_worker }} worker processes"><span class="serverDown server-status"></span>
{% endif %} {% endif %}
{% if role <= 1 %}
<a href="/app/viewlogs.py?viewlogs=checker-error.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker's logs" class="logs_link"> <a href="/app/viewlogs.py?viewlogs=checker-error.log&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" title="View checker's logs" class="logs_link">
<span>Checker workers</span> <span>Checker workers</span>
</a> </a>
{% else %}
<span>Checker workers</span>
{% endif %}
</td> </td>
<td></td> <td></td>
@ -229,27 +240,6 @@
{% endfor %} {% endfor %}
</table> </table>
{% endif %} {% endif %}
<!-- <table class="overview" > -->
<!-- <tr class="overviewHead"> -->
<!-- <td class="padding10 first-collumn-wi"> -->
<!-- Server -->
<!-- </td> -->
<!-- <td class="padding10 second-collumn"> -->
<!-- HAproxy info -->
<!-- </td> -->
<!-- <td class="padding10 third-collumn-wi"> -->
<!-- Server status -->
<!-- </td> -->
<!-- <td class="padding10"> -->
<!-- Front/Back-ends -->
<!-- </td> -->
<!-- <td> -->
<!-- <a onclick="showOverviewServers()" title="Refresh Server Info" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a> -->
<!-- </td> -->
<!-- </tr> -->
<!-- <tbody id="ajaxservers"></tbody> -->
<!-- </table> -->
<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>

View File

@ -22,6 +22,7 @@
</table> </table>
<link href="/inc/chart.min.css" rel="stylesheet"> <link href="/inc/chart.min.css" rel="stylesheet">
<script src="/inc/overview.js"></script>
<script src="/inc/metrics.js"></script> <script src="/inc/metrics.js"></script>
<script src="/inc/chart.min.js"></script> <script src="/inc/chart.min.js"></script>
<div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 20px;" title="Refresh metrics" onclick="showWafMetrics()"> <div id="refresh" style="text-align: right;margin-top: 20px;margin-right: 20px;" title="Refresh metrics" onclick="showWafMetrics()">
@ -32,7 +33,9 @@
<canvas id="s_{{s.0}}" role="img"></canvas> <canvas id="s_{{s.0}}" role="img"></canvas>
</div> </div>
{% endfor %} {% endfor %}
<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>
</div>
<script> <script>
function showWafMetrics() { function showWafMetrics() {
{% for s in servers %} {% for s in servers %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -189,8 +189,6 @@ $( document ).ajaxComplete(function( event, request, settings ) {
}); });
function showOverview() { function showOverview() {
// showOverviewServers();
showOverviewWaf()
showOverviewHapWI() showOverviewHapWI()
$.ajax( { $.ajax( {
url: "options.py", url: "options.py",
@ -210,20 +208,16 @@ function showOverview() {
} ); } );
} }
function showOverviewServer(name,ip,id) { function showOverviewServer(name,ip,id) {
showOverviewServers();
showOverviewWaf()
$.ajax( { $.ajax( {
url: "options.py", url: "options.py",
data: { data: {
act: "overviewServers", act: "overviewServers",
name: name, name: name,
serv: ip, serv: ip,
id: id,
page: 'hapservers.py', page: 'hapservers.py',
token: $('#token').val() token: $('#token').val()
}, },
beforeSend: function() {
$("#ajax-server-"+id).html('<img class="loading" src="/inc/images/loading.gif" />')
},
type: "GET", type: "GET",
success: function( data ) { success: function( data ) {
$("#ajax-server-"+id).empty(); $("#ajax-server-"+id).empty();
@ -284,22 +278,6 @@ function showOverviewWaf() {
} }
} ); } );
} }
function showOverviewServers() {
$.ajax( {
url: "options.py",
data: {
act: "overviewServers",
token: $('#token').val()
},
beforeSend: function() {
$('#ajaxservers').html('<img class="loading" src="/inc/images/loading.gif" />')
},
type: "GET",
success: function( data ) {
$("#ajaxservers").html(data);
}
} );
}
function showOverviewHapWI() { function showOverviewHapWI() {
$.ajax( { $.ajax( {
url: "options.py", url: "options.py",

View File

@ -378,7 +378,7 @@ pre {
padding-left: 15px; padding-left: 15px;
font-size: 15px; font-size: 15px;
} }
.serverUp, .serverDown { .serverUp, .serverDown, .serverNone {
padding: 3px; padding: 3px;
border-radius: 3px; border-radius: 3px;
color: #fff; color: #fff;
@ -387,6 +387,9 @@ pre {
.serverUp { .serverUp {
background-color: #5CB85C; background-color: #5CB85C;
} }
.serverNone {
background-color: #ddd;
}
.add-button, .add-button-wi { .add-button, .add-button-wi {
background-color: #5CB85C; background-color: #5CB85C;
border-radius: 5px; border-radius: 5px;
@ -759,7 +762,6 @@ label {
margin-right: 0 !important; margin-right: 0 !important;
} }
#left-collumn, #middle-collumn, #right-collumn { #left-collumn, #middle-collumn, #right-collumn {
/* width: 30%; */
float: left; float: left;
} }
.ajax-server { .ajax-server {
@ -771,19 +773,24 @@ label {
margin-top: px; margin-top: px;
margin-bottom: 0px; margin-bottom: 0px;
margin-top: 14px; margin-top: 14px;
height: 172px; height: 192px;
} }
.haproxy-info { .haproxy-info {
display: inline-block; display: inline-block;
width: 160px; width: 160px;
padding-left: 20px; padding-left: 30px;
padding-top: 2em; padding-top: 27px;
font-size: 0.88em; font-size: 1em;
} }
.top-info { .top-info {
display: inline-block; display: inline-block;
width: 350px; width: 350px;
} }
.update-icon {
float: right;
margin-top: 35px;
margin-right: 15px;
}
.span-link { .span-link {
cursor: pointer; cursor: pointer;
} }

View File

@ -149,7 +149,7 @@ $( function() {
} else if (data.indexOf('Unauthorized') != '-1') { } else if (data.indexOf('Unauthorized') != '-1') {
$('.alert-danger').remove(); $('.alert-danger').remove();
$('.alert-warning').remove(); $('.alert-warning').remove();
$("#ajax").html('<div class="alert alert-danger">It is seems like you Unauthorized in the HAProxy-WI repository.</data>'); $("#ajax").html('<div class="alert alert-danger">It is seems like you Unauthorized in the HAProxy-WI repository. How to get HAProxy-WI auth you can read <a href="https://haproxy-wi.org/installation.py" title="How to get HAProxy-WI auth">hear</a> </data>');
} else if (data.indexOf('but not installed') != '-1') { } else if (data.indexOf('but not installed') != '-1') {
$('.alert-danger').remove(); $('.alert-danger').remove();
$('.alert-warning').remove(); $('.alert-warning').remove();