Bugs
pull/26/head
Aidaho12 6 years ago
parent f16e5f4af7
commit b92b3ea34a

@ -63,14 +63,12 @@ def logging(serv, action, **kwargs):
print('<center><div class="alert alert-danger">Can\'t read write log. Please chech log_path in config</div></center>')
pass
def telegram_send_mess(mess):
def telegram_send_mess(mess, **kwargs):
import telebot
from telebot import apihelper
import sql
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
user_id = cookie.get('uuid')
telegrams = sql.get_user_telegram_by_uuid(user_id.value)
telegrams = sql.get_telegram_by_ip(kwargs.get('ip'))
for telegram in telegrams:
token_bot = telegram[1]

@ -11,8 +11,13 @@ if [ -f /etc/haproxy/haproxy.cfg ];then
echo -e 'error: Haproxy already installed. You can edit config<a href="/app/config.py" title="Edit HAProxy config">here</a> <br /><br />'
exit 1
fi
sudo wget http://cbs.centos.org/kojifiles/packages/haproxy/1.8.1/5.el7/x86_64/haproxy18-1.8.1-5.el7.x86_64.rpm
sudo yum install haproxy18-1.8.1-5.el7.x86_64.rpm -y
if hash apt-get 2>/dev/null; then
sudo apt-get install haproxy socat -y
else
sudo wget http://cbs.centos.org/kojifiles/packages/haproxy/1.8.1/5.el7/x86_64/haproxy18-1.8.1-5.el7.x86_64.rpm
sudo yum install haproxy18-1.8.1-5.el7.x86_64.rpm -y
fi
if [ $? -eq 1 ]
then
@ -22,7 +27,11 @@ then
fi
if [ $? -eq 1 ]
then
if hash apt-get 2>/dev/null; then
sudo apt-get install socat -y
else
sudo yum install haproxy socat -y > /dev/null
fi
fi
echo "" > /etc/haproxy/haproxy.cfg
sudo bash -c cat << EOF > /etc/haproxy/haproxy.cfg
@ -47,7 +56,7 @@ defaults
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 5s
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m

@ -6,7 +6,12 @@ if [ -f $CONF ];then
exit 1
fi
sudo yum install keepalived -y > /dev/null
if hash apt-get 2>/dev/null; then
sudo apt-get install keepalived -y
else
sudo yum install keepalived -y > /dev/null
fi
if [ $? -eq 1 ]
then
echo "error: Can't install keepalived <br /><br />"

@ -45,7 +45,7 @@ def start_worker(serv):
def kill_worker(serv):
cmd = "ps ax |grep 'tools/checker_worker.py %s'|grep -v grep |awk '{print $1}' |xargs kill" % serv
output, stderr = funct.subprocess_execute(cmd)
funct.logging("localhost", "Masrer killed worker for: "+serv, alerting=1)
funct.logging("localhost", " Masrer killed worker for: "+serv, alerting=1)
if stderr:
funct.logging("localhost", stderr, alerting=1)

@ -48,7 +48,7 @@ def main(serv, port):
servername = servername.split(",")
realserver = servername[0]
alert = realserver[2:]+ " has changed status and is now "+ currentstat[i] + " at " + serv
funct.telegram_send_mess(str(alert))
funct.telegram_send_mess(str(alert), ip=serv)
funct.logging("localhost", " "+alert, alerting=1)
firstrun = False
oldstat = []

Loading…
Cancel
Save