mirror of https://github.com/Aidaho12/haproxy-wi
v3.5
parent
8d425625b8
commit
9e14f89daf
|
@ -139,6 +139,18 @@ if act == "overviewServers":
|
|||
name = form.getvalue('name')
|
||||
ovw.get_overviewServers(ip=serv,name=name,page=form.getvalue('page'))
|
||||
|
||||
|
||||
if act == "overviewHapwi":
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/overviewHapwi.html')
|
||||
cmd = "top -b -n 1 |head -9"
|
||||
server_status, stderr = funct.subprocess_execute(cmd)
|
||||
|
||||
template = template.render(server_status=server_status,stderr=stderr)
|
||||
print(template)
|
||||
|
||||
|
||||
if form.getvalue('action'):
|
||||
import requests
|
||||
from requests_toolbelt.utils import dump
|
||||
|
|
|
@ -30,8 +30,6 @@ try:
|
|||
metrics_worker, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "ps ax |grep -e 'keep_alive.py' |grep -v grep |wc -l"
|
||||
keep_alive, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "top -b -n 1 -w 77 |head -9"
|
||||
server_status_row, stderr = funct.subprocess_execute(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -49,7 +47,6 @@ template = template.render(h2 = 1,
|
|||
checker_master = ''.join(checker_master),
|
||||
checker_worker = ''.join(checker_worker),
|
||||
keep_alive = ''.join(keep_alive),
|
||||
server_status = server_status_row,
|
||||
date = funct.get_data('logs'),
|
||||
error = stderr,
|
||||
versions = funct.versions(),
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{% for s in server_status %}
|
||||
<span style="margin-bottom: -45px;display: block;font-size: 10px;">{{ s }}</span>
|
||||
{{stderr}}
|
||||
{% endfor %}
|
|
@ -50,15 +50,16 @@
|
|||
HAProxy-WI server status
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a onclick="showOverviewHapWI()" title="Refresh" style="float: right; margin-right: 25px;"><img src="/inc/images/update.png" alt="restart" class="icon"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:90%">
|
||||
<pre style="margin: 0;">
|
||||
{% for s in server_status %}
|
||||
<span style="margin-bottom: -30px;display: block;font-size: 10px;">{{ s }}</span>
|
||||
{% endfor %}
|
||||
<pre style="margin: 0;" id="ajaxHapwi">
|
||||
</pre>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="overview-wi" style="height: 170;">
|
||||
|
|
|
@ -191,6 +191,7 @@ $( document ).ajaxComplete(function( event, request, settings ) {
|
|||
function showOverview() {
|
||||
// showOverviewServers();
|
||||
showOverviewWaf()
|
||||
showOverviewHapWI()
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
|
@ -277,6 +278,19 @@ function showOverviewServers() {
|
|||
}
|
||||
} );
|
||||
}
|
||||
function showOverviewHapWI() {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
act: "overviewHapwi",
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
$("#ajaxHapwi").html(data);
|
||||
}
|
||||
} );
|
||||
}
|
||||
function showStats() {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
|
|
Loading…
Reference in New Issue