mirror of https://github.com/Aidaho12/haproxy-wi
parent
c1dd051893
commit
695bd7155f
|
@ -9,6 +9,8 @@ def is_ip_or_dns(server_from_request: str) -> str:
|
||||||
ip_regex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
|
ip_regex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
|
||||||
dns_regex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"
|
dns_regex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"
|
||||||
try:
|
try:
|
||||||
|
if server_from_request == 'roxy-wi-keep_alive':
|
||||||
|
return 'roxy-wi-keep_alive'
|
||||||
if re.match(ip_regex, server_from_request):
|
if re.match(ip_regex, server_from_request):
|
||||||
return server_from_request
|
return server_from_request
|
||||||
else:
|
else:
|
||||||
|
@ -1333,9 +1335,12 @@ def get_services_status():
|
||||||
if service_name == 'prometheus':
|
if service_name == 'prometheus':
|
||||||
cmd = "prometheus --version 2>&1 |grep prometheus|awk '{print $3}'"
|
cmd = "prometheus --version 2>&1 |grep prometheus|awk '{print $3}'"
|
||||||
else:
|
else:
|
||||||
cmd = "rpm --query " + service_name + "-* |awk -F\"" + service_name + "\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'"
|
cmd = "rpm -q " + service_name + "|awk -F\"" + service_name + "\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'"
|
||||||
service_ver, stderr = subprocess_execute(cmd)
|
service_ver, stderr = subprocess_execute(cmd)
|
||||||
|
|
||||||
|
if service_ver[0] == 'command':
|
||||||
|
service_ver[0] = ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
services.append([s, status, v, service_ver[0]])
|
services.append([s, status, v, service_ver[0]])
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -129,7 +129,7 @@ for s in servers:
|
||||||
|
|
||||||
if is_keepalived:
|
if is_keepalived:
|
||||||
try:
|
try:
|
||||||
cmd = ['sudo kill -USR1 `cat /var/run/keepalived.pid` && grep State /tmp/keepalived.data -m 1 |awk -F"=" \'{print $2}\'|tr -d \'[:space:]\' && sudo rm -f /tmp/keepalived.data' ]
|
cmd = ['sudo kill -USR1 `cat /var/run/keepalived.pid` && sudo grep State /tmp/keepalived.data -m 1 |awk -F"=" \'{print $2}\'|tr -d \'[:space:]\' && sudo rm -f /tmp/keepalived.data' ]
|
||||||
out = funct.ssh_command(s[2], cmd)
|
out = funct.ssh_command(s[2], cmd)
|
||||||
out1 = ('1', out)
|
out1 = ('1', out)
|
||||||
servers_with_status.append(out1)
|
servers_with_status.append(out1)
|
||||||
|
|
|
@ -710,7 +710,7 @@ if form.getvalue('action'):
|
||||||
'Accept-Encoding': 'gzip, deflate'
|
'Accept-Encoding': 'gzip, deflate'
|
||||||
}
|
}
|
||||||
|
|
||||||
q = requests.post('http://' + serv + ':' + stats_port + '/' + stats_page,
|
q = requests.post('http://{}:{}/{}'.format(serv, stats_port, stats_page),
|
||||||
headers=headers,
|
headers=headers,
|
||||||
data=postdata,
|
data=postdata,
|
||||||
auth=(haproxy_user, haproxy_pass))
|
auth=(haproxy_user, haproxy_pass))
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<td class="padding10 first-collumn" style="width: 25%;">
|
<td class="padding10 first-collumn" style="width: 25%;">
|
||||||
Profile name
|
Profile name
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10 first-collumn" style="width: 35%;">
|
<td style="width: 35%;">
|
||||||
Time of creation
|
Created
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
<tr class="overviewHead" style="width: 50%;">
|
<tr class="overviewHead" style="width: 50%;">
|
||||||
<td class="padding10 first-collumn" style="width: 25%;">Ovpn file name</td>
|
<td class="padding10 first-collumn" style="width: 25%;">Ovpn file name</td>
|
||||||
<td>
|
<td>
|
||||||
<span title="Ovpn file must be with an auto-login profile">Upload ovpn file (?)</span>
|
<span title="Ovpn file must be with an auto-login profile" class="help_cursor">Upload a file</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="width: 50%;">
|
<tr style="width: 50%;">
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
{% if dis.append(s.group) %} {% endif %}
|
{% if dis.append(s.group) %} {% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<b>Counting state: UP: {{up|length}}, DOWN: {{down|length}}, Disabled: {{dis|length}}</b>
|
<b>Status summary: UP: {{up|length}}, DOWN: {{down|length}}, Disabled: {{dis|length}}</b>
|
||||||
<span>
|
<span>
|
||||||
</div>
|
</div>
|
||||||
{% set group = [] %}
|
{% set group = [] %}
|
||||||
|
|
|
@ -262,7 +262,7 @@
|
||||||
<td>
|
<td>
|
||||||
<select id="disable_alerting">
|
<select id="disable_alerting">
|
||||||
<option value="0" title="Alerts for all tabs are enabled">All alerts are enabled</option>
|
<option value="0" title="Alerts for all tabs are enabled">All alerts are enabled</option>
|
||||||
<option value="1">Disable alerting for this tab</option>
|
<option value="1">Disable alerting for the current</option>
|
||||||
<option value="2">Disable alerting for all tabs</option>
|
<option value="2">Disable alerting for all tabs</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue