mirror of https://github.com/Aidaho12/haproxy-wi
parent
eebbf4354f
commit
2715ecab29
|
@ -28,6 +28,7 @@ Support the project
|
|||
18. SSH Key support for managing multiple HAproxy Servers straight from haproxy-wi
|
||||
19. SYN flood protect
|
||||
20. Alerting about changes backends state
|
||||
21. Alerting about HAProxy service state
|
||||
|
||||
# Install
|
||||
The installer will ask you a few questions
|
||||
|
|
|
@ -319,6 +319,7 @@
|
|||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="ssh">
|
||||
<table id="ssh_enable_table" class="overview">
|
||||
<tr class="overviewHead" style="width: 50%;">
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
</ul>
|
||||
</nav>
|
||||
<div class="copyright-menu">
|
||||
HAproxy-WI v2.7.2.2
|
||||
HAproxy-WI v2.7.3
|
||||
<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>
|
||||
|
|
|
@ -319,6 +319,7 @@
|
|||
$('#add-ssh-button').css('display', 'none');
|
||||
$('#ssh_key_upload').css('display', 'none');
|
||||
$('#add-telegram-button').css('display', 'none');
|
||||
$('input').css('color', 'rgba(0, 0, 0, 0.3)');
|
||||
setTimeout(function() {
|
||||
$("input[type=checkbox]").checkboxradio( "disable" );
|
||||
$("select").selectmenu( "disable" );
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
from subprocess import check_output, CalledProcessError
|
||||
import time
|
||||
import argparse
|
||||
import os, sys
|
||||
|
@ -23,18 +24,40 @@ def main(serv, port):
|
|||
currentstat = []
|
||||
readstats = ""
|
||||
killer = GracefulKiller()
|
||||
old_stat_service = ""
|
||||
|
||||
while True:
|
||||
try:
|
||||
try:
|
||||
readstats = subprocess.check_output(["echo show stat | nc "+serv+" "+port], shell=True)
|
||||
except:
|
||||
print("Unexpected error:", sys.exc_info())
|
||||
except CalledProcessError as e:
|
||||
if firstrun == False:
|
||||
cur_stat_service = "error"
|
||||
if old_stat_service != cur_stat_service:
|
||||
alert = "Can't connect to HAProxy service at " + serv
|
||||
funct.telegram_send_mess(str(alert), ip=serv)
|
||||
funct.logging("localhost", " "+alert, alerting=1)
|
||||
|
||||
firstrun = False
|
||||
old_stat_service = cur_stat_service
|
||||
continue
|
||||
except OSError as e:
|
||||
print(e)
|
||||
sys.exit()
|
||||
else:
|
||||
cur_stat_service = "Ok"
|
||||
if firstrun == False:
|
||||
if old_stat_service != cur_stat_service:
|
||||
alert = "Now UP HAProxy service at " + serv
|
||||
funct.telegram_send_mess(str(alert), ip=serv)
|
||||
funct.logging("localhost", " "+alert, alerting=1)
|
||||
firstrun = True
|
||||
time.sleep(2)
|
||||
old_stat_service = cur_stat_service
|
||||
|
||||
vips = readstats.splitlines()
|
||||
|
||||
|
||||
for i in range(0,len(vips)):
|
||||
if "UP" in str(vips[i]):
|
||||
if "UP" in str(vips[i]):
|
||||
currentstat.append("UP")
|
||||
elif "DOWN" in str(vips[i]):
|
||||
currentstat.append("DOWN")
|
||||
|
|
|
@ -184,6 +184,8 @@ cat << EOF > /etc/logrotate.d/checker
|
|||
rotate 10
|
||||
missingok
|
||||
notifempty
|
||||
create 0644 apache apache
|
||||
dateext
|
||||
sharedscripts
|
||||
}
|
||||
EOF
|
||||
|
|
Loading…
Reference in New Issue