mirror of https://github.com/Aidaho12/haproxy-wi
parent
cfd696b50b
commit
650b22e55c
|
@ -32,6 +32,7 @@ Support the project
|
|||
20. Alerting about changes backends state
|
||||
21. Alerting about HAProxy service state
|
||||
22. Metrics incoming connections
|
||||
23. Web acceleration settings
|
||||
|
||||
![alt text](image/haproxy-wi-metrics.jpeg "Merics")
|
||||
|
||||
|
|
25
app/add.py
25
app/add.py
|
@ -55,12 +55,15 @@ if form.getvalue('mode') is not None:
|
|||
if form.getvalue('listner') is not None:
|
||||
name = "\nlisten " + form.getvalue('listner')
|
||||
backend = ""
|
||||
end_name = form.getvalue('listner')
|
||||
elif form.getvalue('frontend') is not None:
|
||||
name = "\nfrontend " + form.getvalue('frontend')
|
||||
backend = " default_backend " + form.getvalue('backend') + "\n"
|
||||
end_name = form.getvalue('frontend')
|
||||
elif form.getvalue('new_backend') is not None:
|
||||
name = "\nbackend " + form.getvalue('new_backend')
|
||||
backend = ""
|
||||
end_name = form.getvalue('new_backend')
|
||||
|
||||
if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp":
|
||||
ssl = "ssl crt " + cert_path + form.getvalue('cert')
|
||||
|
@ -143,8 +146,21 @@ if form.getvalue('mode') is not None:
|
|||
servers_split += " server " + j + check + "\n"
|
||||
else:
|
||||
servers_split = ""
|
||||
|
||||
en_acceleration = form.getvalue("acceleration")
|
||||
acceleration = ""
|
||||
cache = ""
|
||||
cache_set = ""
|
||||
filter = ""
|
||||
if en_acceleration:
|
||||
filter = " filter compression\n"
|
||||
if en_acceleration == "1" or en_acceleration == "3":
|
||||
acceleration = " compression algo gzip\n compression type text/html text/plain text/css\n"
|
||||
if en_acceleration == "2" or en_acceleration == "3":
|
||||
cache = " http-request cache-use "+end_name+"\n http-response cache-store "+end_name+"\n"
|
||||
cache_set = "cache "+end_name+"\n total-max-size 4\n max-age 240\n"
|
||||
|
||||
config_add = name + "\n" + bind + mode + "\n" + balance + options_split + backend + servers_split + "\n"
|
||||
config_add = name + "\n" + bind + mode + "\n" + balance + options_split + backend + filter + acceleration + cache + servers_split + "\n" + cache_set
|
||||
cfg = hap_configs_dir + serv + "-" + funct.get_data('config') + ".cfg"
|
||||
|
||||
funct.get_config(serv, cfg)
|
||||
|
@ -162,8 +178,11 @@ if form.getvalue('mode') is not None:
|
|||
if master[0] != None:
|
||||
funct.upload_and_restart(master[0], cfg)
|
||||
|
||||
funct.upload_and_restart(serv, cfg)
|
||||
print('<meta http-equiv="refresh" content="0; url=add.py?add=%s&conf=%s">' % (name, config_add))
|
||||
stderr = funct.upload_and_restart(serv, cfg)
|
||||
if stderr:
|
||||
print('<div class="alert alert-danger">%s</div>' % stderr)
|
||||
else:
|
||||
print('<meta http-equiv="refresh" content="0; url=add.py?add=%s&conf=%s">' % (name, config_add))
|
||||
|
||||
print('</div>')
|
||||
|
||||
|
|
|
@ -450,4 +450,9 @@ if form.getvalue('metrics'):
|
|||
plots.append(value)
|
||||
|
||||
grid = gridplot(plots, ncols=2, plot_width=800, plot_height=250, toolbar_location = "left", toolbar_options=dict(logo=None))
|
||||
show(grid)
|
||||
show(grid)
|
||||
|
||||
if form.getvalue('get_hap_v'):
|
||||
commands = [ "haproxy -v |grep ver|awk '{print $3}'" ]
|
||||
output = funct.ssh_command(serv, commands)
|
||||
print(output)
|
|
@ -67,11 +67,12 @@ defaults
|
|||
maxconn 3000
|
||||
|
||||
listen stats
|
||||
bind *:8085
|
||||
stats enable
|
||||
stats uri /stats
|
||||
stats realm HAProxy-04\ Statistics
|
||||
stats auth admin:password
|
||||
bind *:8085
|
||||
stats enable
|
||||
stats uri /stats
|
||||
stats realm HAProxy-04\ Statistics
|
||||
stats auth admin:password
|
||||
stats admin if TRUE
|
||||
EOF
|
||||
sudo bash -c cat << EOF > /etc/rsyslog.d/haproxy.conf
|
||||
local2.* /var/log/haproxy.log
|
||||
|
|
|
@ -72,6 +72,17 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Web acceleration: </td>
|
||||
<td class="addOption">
|
||||
<select name="acceleration" id="acceleration">
|
||||
<option value="0" selected>Off</option>
|
||||
<option value="1">Compression</option>
|
||||
<option value="2">Cache</option>
|
||||
<option value="3">Compression + Cache</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Optinons:</td>
|
||||
<td class="addOption">
|
||||
|
@ -218,6 +229,17 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Web acceleration: </td>
|
||||
<td class="addOption">
|
||||
<select name="acceleration" id="acceleration2">
|
||||
<option value="0" selected>Off</option>
|
||||
<option value="1">Compression</option>
|
||||
<option value="2">Cache</option>
|
||||
<option value="3">Compression + Cache</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Optinons:</td>
|
||||
<td class="addOption">
|
||||
|
@ -319,6 +341,17 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName"><span title="Cache support start 1.8 and latter">Web acceleration(?):</span></td>
|
||||
<td class="addOption">
|
||||
<select name="acceleration" id="acceleration3">
|
||||
<option value="0" selected>Off</option>
|
||||
<option value="1">Compression</option>
|
||||
<option value="2">Cache</option>
|
||||
<option value="3">Compression + Cache</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="addName">Optinons:</td>
|
||||
<td class="addOption">
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
{{ service.2 }}
|
||||
</pre>
|
||||
</td>
|
||||
<td style="padding-top: 10px;">
|
||||
<td>
|
||||
<pre style="font-size: 12px; padding-left: 0px;">
|
||||
{{ service.3 }}
|
||||
</pre>
|
||||
</td>
|
||||
<td style="padding: 10px;font-size: 12px;">
|
||||
<pre>
|
||||
<td style="padding: 10px; padding-bottom: 0;font-size: 12px;">
|
||||
<pre style="padding-left: 0px; margin: 0;">
|
||||
{{ service.4 }}
|
||||
</pre>
|
||||
</td>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
</ul>
|
||||
</nav>
|
||||
<div class="copyright-menu">
|
||||
HAproxy-WI v2.8
|
||||
HAproxy-WI v2.8.1
|
||||
<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>
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<tr class="overviewHead">
|
||||
<td class="padding10 first-collumn">Login</td>
|
||||
<td class="padding10 second-collumn">Email</td>
|
||||
<td class="padding10 second-collumn">Group</td>
|
||||
<td class="padding10">Role</td>
|
||||
<td class="second-collumn">Group</td>
|
||||
<td>Role</td>
|
||||
<td class="padding10">
|
||||
<span class="add-button">
|
||||
<a title="Show all users" id="show-all-users" style="color: #fff">
|
||||
|
@ -26,10 +26,10 @@
|
|||
{% if counter <= 2 %}
|
||||
<tr class="{{ loop.cycle('odd', 'even') }}">
|
||||
<td class="padding10 first-collumn"> {{ USER.1 }}</td>
|
||||
<td class="padding10"> {{ USER.2 }}</td>
|
||||
<td class="padding10 second-collumn"> {{ USER.2 }}</td>
|
||||
{% for group in groups %}
|
||||
{% if USER.5 == group.0|string() %}
|
||||
<td class="second-collumn">{{ group.1 }}</td>
|
||||
<td class="third-collumn">{{ group.1 }}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td>{{ USER.4 }}</td>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<td class="padding10"> {{ USER.2 }}</td>
|
||||
{% for group in groups %}
|
||||
{% if group.0|string() == USER.5 %}
|
||||
<td class="second-collumn">{{ group.1 }}</td>
|
||||
<td class="third-collumn">{{ group.1 }}</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<td>{{ USER.4 }}</td>
|
||||
|
@ -65,14 +65,14 @@
|
|||
<span title="running {{ metrics_master }} master processes"><span class="serverDown"> DOWN</span> running {{metrics_master }} master processes
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<td class="padding10 second-collumn">
|
||||
{% if metrics_worker|int() >= 1 %}
|
||||
<span title="running {{metrics_worker}} worker processes"><span class="serverUp"> UP</span> Metrics workers</span>
|
||||
{% else %}
|
||||
<span title="running {{metrics_worker}} worker processes"><span class="serverDown"> DOWN</span> Metrics workers</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td >
|
||||
<td class="third-collumn">
|
||||
{% if checker_master|int() >= 1 %}
|
||||
<span title="running {{ checker_master }} master processes"><span class="serverUp"> UP</span> Checker master</span>
|
||||
{% else %}
|
||||
|
@ -93,11 +93,11 @@
|
|||
<tr class="overviewHead">
|
||||
<td class="padding10 first-collumn">
|
||||
Server
|
||||
</td>
|
||||
</td class="padding10 second-collumn">
|
||||
<td class="padding10 second-collumn">
|
||||
HAproxy status
|
||||
</td>
|
||||
<td class="padding10 second-collumn">
|
||||
<td class="padding10 third-collumn">
|
||||
Action
|
||||
</td>
|
||||
<td class="padding10">
|
||||
|
@ -118,7 +118,7 @@
|
|||
<td class="padding10 second-collumn">
|
||||
HAproxy info
|
||||
</td>
|
||||
<td class="padding10 second-collumn">
|
||||
<td class="padding10 third-collumn">
|
||||
Server status
|
||||
</td>
|
||||
<td class="padding10">
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 341 KiB After Width: | Height: | Size: 361 KiB |
Binary file not shown.
Before Width: | Height: | Size: 801 KiB After Width: | Height: | Size: 763 KiB |
|
@ -761,24 +761,7 @@ $( function() {
|
|||
$("#optionsInput2").append(ui.item.value + " ")
|
||||
}
|
||||
});
|
||||
$( "#path-cert-listen" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
getcert:1,
|
||||
serv: $("#serv").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
|
||||
var ssl_offloading_var = "http-request set-header X-Forwarded-Port %[dst_port] \n"+
|
||||
"http-request add-header X-Forwarded-Proto https if { ssl_fc } \n"+
|
||||
"redirect scheme https if !{ ssl_fc } \n"
|
||||
|
@ -956,12 +939,47 @@ $( function() {
|
|||
replace_text("#optionsInput2", ddos_var);
|
||||
}
|
||||
});
|
||||
$("#acceleration").selectmenu( "disable" );
|
||||
$( "#serv" ).on('selectmenuchange',function() {
|
||||
$("#acceleration").selectmenu( "enable" );
|
||||
change_select_acceleration("");
|
||||
});
|
||||
|
||||
$("#acceleration2").selectmenu( "disable" );
|
||||
$( "#serv2" ).on('selectmenuchange',function() {
|
||||
$("#acceleration2").selectmenu( "enable" );
|
||||
change_select_acceleration(2);
|
||||
});
|
||||
|
||||
$("#acceleration3").selectmenu( "disable" );
|
||||
$( "#serv3" ).on('selectmenuchange',function() {
|
||||
$("#acceleration3").selectmenu( "enable" );
|
||||
change_select_acceleration("3");
|
||||
});
|
||||
$( "#path-cert-listen" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
getcerts:1,
|
||||
serv: $("#serv").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#path-cert-frontend" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
getcert:1,
|
||||
getcerts:1,
|
||||
serv: $("#serv2").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
|
@ -979,7 +997,7 @@ $( function() {
|
|||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
getcert:1,
|
||||
getcerts:1,
|
||||
serv: $("#serv3").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
|
@ -1110,6 +1128,30 @@ $( function() {
|
|||
return false;
|
||||
});
|
||||
});
|
||||
function change_select_acceleration(id) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
get_hap_v: 1,
|
||||
serv: $('#serv'+id+' option:selected').val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
if(parseFloat(data) < parseFloat('1.8')) {
|
||||
console.log(false)
|
||||
$('#acceleration'+id+' option[value=2]').attr('disabled','disabled');
|
||||
$('#acceleration'+id+' option[value=3]').attr('disabled','disabled');
|
||||
} else {
|
||||
console.log('true')
|
||||
$('#acceleration'+id+' option[value=2]').removeAttr('disabled','disabled');
|
||||
$('#acceleration'+id+' option[value=3]').removeAttr('disabled','disabled');
|
||||
}
|
||||
$("#acceleration"+id).selectmenu( "refresh" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
function replace_text(id_textarea, text_var) {
|
||||
var str = $(id_textarea).val();
|
||||
var len = str.length;
|
||||
|
|
|
@ -321,10 +321,13 @@ pre {
|
|||
}
|
||||
.first-collumn {
|
||||
padding-left: 15px;
|
||||
width: 10%;
|
||||
width: 15%;
|
||||
}
|
||||
.second-collumn {
|
||||
width: 30%;
|
||||
width: 25%;
|
||||
}
|
||||
.third-collumn {
|
||||
width: 35%;
|
||||
}
|
||||
.ro {
|
||||
border: none;
|
||||
|
|
Loading…
Reference in New Issue