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])$"
|
||||
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:
|
||||
if server_from_request == 'roxy-wi-keep_alive':
|
||||
return 'roxy-wi-keep_alive'
|
||||
if re.match(ip_regex, server_from_request):
|
||||
return server_from_request
|
||||
else:
|
||||
|
@ -1333,9 +1335,12 @@ def get_services_status():
|
|||
if service_name == 'prometheus':
|
||||
cmd = "prometheus --version 2>&1 |grep prometheus|awk '{print $3}'"
|
||||
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)
|
||||
|
||||
if service_ver[0] == 'command':
|
||||
service_ver[0] = ''
|
||||
|
||||
try:
|
||||
services.append([s, status, v, service_ver[0]])
|
||||
except Exception:
|
||||
|
|
|
@ -129,7 +129,7 @@ for s in servers:
|
|||
|
||||
if is_keepalived:
|
||||
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)
|
||||
out1 = ('1', out)
|
||||
servers_with_status.append(out1)
|
||||
|
@ -150,6 +150,6 @@ template = template.render(h2=1,
|
|||
serv=serv,
|
||||
service=service,
|
||||
services=services,
|
||||
user_services=user_services,
|
||||
user_services=user_services,
|
||||
token=token)
|
||||
print(template)
|
||||
|
|
|
@ -710,7 +710,7 @@ if form.getvalue('action'):
|
|||
'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,
|
||||
data=postdata,
|
||||
auth=(haproxy_user, haproxy_pass))
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<td class="padding10 first-collumn" style="width: 25%;">
|
||||
Profile name
|
||||
</td>
|
||||
<td class="padding10 first-collumn" style="width: 35%;">
|
||||
Time of creation
|
||||
<td style="width: 35%;">
|
||||
Created
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<tr class="overviewHead" style="width: 50%;">
|
||||
<td class="padding10 first-collumn" style="width: 25%;">Ovpn file name</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>
|
||||
</tr>
|
||||
<tr style="width: 50%;">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
{% if dis.append(s.group) %} {% endif %}
|
||||
{% endif %}
|
||||
{% 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>
|
||||
</div>
|
||||
{% set group = [] %}
|
||||
|
|
|
@ -262,7 +262,7 @@
|
|||
<td>
|
||||
<select id="disable_alerting">
|
||||
<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>
|
||||
</select>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue