Improved Overview page
pull/21/head
Aidaho12 6 years ago
parent 00aaa0a481
commit bc87a22731

@ -415,17 +415,17 @@ def show_ip(stdout):
for line in stdout:
print(line)
def server_status(stdout):
def server_status(stdout):
proc_count = ""
i = 0
for line in stdout.read().decode(encoding='UTF-8'):
i = i + 1
if i == 1:
proc_count += line
if line.find("0"):
err = 1
else:
err = 0
for line in stdout:
if "Ncat: Connection refused." not in line:
for k in line:
proc_count = k.split(":")[1]
err = 1
else:
err = 0
proc_count = 0
if err != 0:
print('<span class="serverUp"> UP</span> running %s processes' % proc_count)

@ -14,12 +14,12 @@ form = cgi.FieldStorage()
def get_overview():
listhap = sql.get_dick_permit()
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
commands1 = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
for server in listhap:
print('<tr><td class="padding10 first-collumn"><a href="#%s" title="Go to %s status" style="color: #000">%s</a></td><td class="second-collumn">' % (server[1], server[1], server[1]))
funct.ssh_command(server[2], commands, server_status="1")
cmd = 'echo "show info" |nc %s 1999 |grep -e "Process_num"' % server[2]
funct.server_status(funct.subprocess_execute(cmd))
print('</td><td>')
if funct.is_admin():
print('<a id="%s" class="start" title="Start HAproxy service"><img src=/image/pic/start.png alt="start" class="icon"></a>' % server[2])
@ -31,22 +31,28 @@ def get_overview():
print('<a href="/app/diff.py?serv=%s&open=open#diff" title="Compare config"><img src=/image/pic/compare.png alt="compare" class="icon"></a>' % server[2])
print('<a href="/app/map.py?serv=%s&open=open#map" title="Map listen/frontend/backend"><img src=/image/pic/map.png alt="map" class="icon"></a>' % server[2])
print('</td><td>')
funct.ssh_command(server[2], commands1)
funct.ssh_command(server[2], commands)
print('</td><td></td></tr>')
def get_overviewServers():
listhap = sql.get_dick_permit()
commands = [ "uname -smor",
"haproxy -v |head -1",
status_command + "|grep Active |awk -F':' '{print $2\":\"$3\":\"$4}' | sed 's/^[ \t]*//'" ]
commands1 = [ "top -u haproxy -b -n 1" ]
commands = [ "top -u haproxy -b -n 1" ]
for server in sorted(listhap):
print('<tr><td class="overviewTr first-collumn"><a name="'+server[1]+'"></a><h3 title="IP ' + server[2] + '">' + server[1] + ':</h3></td>')
print('<td class="overviewTd" style="padding-top: 10px;"><pre style="font-size: 12px;">')
cmd = 'echo "show info" |nc %s 1999 |grep -e "Ver\|CurrConns\|SessRate\|Maxco\|MB\|Uptime:"' % server[2]
out = funct.subprocess_execute(cmd)
for k in out:
if "Ncat: Connection refused." not in k:
for r in k:
print(r)
else:
print("Can\'t connect to HAproxy")
print('</pre></td><td style="padding-top: 10px;"><pre style="font-size: 12px; padding-left: 0px;">')
funct.ssh_command(server[2], commands)
print('</pre></td><td style="padding-top: 10px;"><pre style="font-size: 12px;">')
funct.ssh_command(server[2], commands1)
print('</td><td style="padding: 10px;font-size: 13px;">')
print('</td><td style="padding: 10px;font-size: 12px;">')
funct.show_backends(server[2])
print('</pre></td><td></td></tr>')

@ -97,7 +97,7 @@
</ul>
</nav>
<div class="copyright-menu">
HAproxy-WI v2.6.1
HAproxy-WI v2.6.2
<br>
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
</div>

@ -65,7 +65,9 @@
<td class="padding10">
Last edit
</td class="padding10">
<td></td>
<td>
<a onclick="showOverview()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/image/pic/update.png" alt="restart" class="icon"></a>
</td>
</tr>
<tbody id="ajaxstatus"></tbody>
@ -85,6 +87,7 @@
Front/Back-ends
</td>
<td>
<a onclick="showOverviewServers()" title="Refresh Server Info" style="float: right; margin-right: 25px;"><img src="/image/pic/update.png" alt="restart" class="icon"></a>
</td>
</tr>
<tbody id="ajaxservers"></tbody>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 KiB

After

Width:  |  Height:  |  Size: 562 KiB

Loading…
Cancel
Save