Pavel Loginov 2021-08-23 13:23:24 +06:00
parent c1dd051893
commit 695bd7155f
6 changed files with 14 additions and 9 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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))

View File

@ -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%;">

View File

@ -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 = [] %}

View File

@ -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>