mirror of https://github.com/Aidaho12/haproxy-wi
parent
00aaa0a481
commit
bc87a22731
12
app/funct.py
12
app/funct.py
|
@ -417,15 +417,15 @@ def show_ip(stdout):
|
||||||
|
|
||||||
def server_status(stdout):
|
def server_status(stdout):
|
||||||
proc_count = ""
|
proc_count = ""
|
||||||
i = 0
|
|
||||||
for line in stdout.read().decode(encoding='UTF-8'):
|
for line in stdout:
|
||||||
i = i + 1
|
if "Ncat: Connection refused." not in line:
|
||||||
if i == 1:
|
for k in line:
|
||||||
proc_count += line
|
proc_count = k.split(":")[1]
|
||||||
if line.find("0"):
|
|
||||||
err = 1
|
err = 1
|
||||||
else:
|
else:
|
||||||
err = 0
|
err = 0
|
||||||
|
proc_count = 0
|
||||||
|
|
||||||
if err != 0:
|
if err != 0:
|
||||||
print('<span class="serverUp"> UP</span> running %s processes' % proc_count)
|
print('<span class="serverUp"> UP</span> running %s processes' % proc_count)
|
||||||
|
|
28
app/ovw.py
28
app/ovw.py
|
@ -14,12 +14,12 @@ form = cgi.FieldStorage()
|
||||||
def get_overview():
|
def get_overview():
|
||||||
listhap = sql.get_dick_permit()
|
listhap = sql.get_dick_permit()
|
||||||
|
|
||||||
commands = [ "ps -Af |grep [h]aproxy |wc -l" ]
|
commands = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
|
||||||
commands1 = [ "ls -l %s |awk '{ print $6\" \"$7\" \"$8}'" % haproxy_config_path ]
|
|
||||||
|
|
||||||
for server in listhap:
|
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]))
|
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>')
|
print('</td><td>')
|
||||||
if funct.is_admin():
|
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])
|
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/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('<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>')
|
print('</td><td>')
|
||||||
funct.ssh_command(server[2], commands1)
|
funct.ssh_command(server[2], commands)
|
||||||
print('</td><td></td></tr>')
|
print('</td><td></td></tr>')
|
||||||
|
|
||||||
def get_overviewServers():
|
def get_overviewServers():
|
||||||
listhap = sql.get_dick_permit()
|
listhap = sql.get_dick_permit()
|
||||||
commands = [ "uname -smor",
|
commands = [ "top -u haproxy -b -n 1" ]
|
||||||
"haproxy -v |head -1",
|
|
||||||
status_command + "|grep Active |awk -F':' '{print $2\":\"$3\":\"$4}' | sed 's/^[ \t]*//'" ]
|
|
||||||
commands1 = [ "top -u haproxy -b -n 1" ]
|
|
||||||
for server in sorted(listhap):
|
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('<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;">')
|
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)
|
funct.ssh_command(server[2], commands)
|
||||||
print('</pre></td><td style="padding-top: 10px;"><pre style="font-size: 12px;">')
|
print('</td><td style="padding: 10px;font-size: 12px;">')
|
||||||
funct.ssh_command(server[2], commands1)
|
|
||||||
print('</td><td style="padding: 10px;font-size: 13px;">')
|
|
||||||
funct.show_backends(server[2])
|
funct.show_backends(server[2])
|
||||||
print('</pre></td><td></td></tr>')
|
print('</pre></td><td></td></tr>')
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="copyright-menu">
|
<div class="copyright-menu">
|
||||||
HAproxy-WI v2.6.1
|
HAproxy-WI v2.6.2
|
||||||
<br>
|
<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>
|
<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>
|
</div>
|
||||||
|
|
|
@ -65,7 +65,9 @@
|
||||||
<td class="padding10">
|
<td class="padding10">
|
||||||
Last edit
|
Last edit
|
||||||
</td class="padding10">
|
</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>
|
</tr>
|
||||||
<tbody id="ajaxstatus"></tbody>
|
<tbody id="ajaxstatus"></tbody>
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@
|
||||||
Front/Back-ends
|
Front/Back-ends
|
||||||
</td>
|
</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tbody id="ajaxservers"></tbody>
|
<tbody id="ajaxservers"></tbody>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 483 KiB After Width: | Height: | Size: 562 KiB |
Loading…
Reference in New Issue