diff --git a/app/ovw.py b/app/ovw.py index 5cfd99fb..84fe5c83 100644 --- a/app/ovw.py +++ b/app/ovw.py @@ -18,7 +18,7 @@ async def async_get_overview(serv1, serv2): commands1 = [ "ps ax |grep waf/bin/modsecurity |grep -v grep |wc -l" ] cmd = 'echo "show info" |nc %s %s |grep -e "Process_num"' % (serv2, haproxy_sock_port) - server_status = (serv1, serv2, funct.server_status(funct.subprocess_execute(cmd)), funct.ssh_command(serv2, commands), funct.ssh_command(serv2, commands1)) + server_status = (serv1, serv2, funct.server_status(funct.subprocess_execute(cmd)), funct.ssh_command(serv2, commands), funct.ssh_command(serv2, commands1), sql.select_servers(server=serv2, keep_alive=1)) return server_status async def get_runner_overview(): diff --git a/app/sql.py b/app/sql.py index c288720d..3ca66e18 100644 --- a/app/sql.py +++ b/app/sql.py @@ -238,6 +238,7 @@ def select_user_name_group(id): def select_servers(**kwargs): con, cur = create_db.get_cur() sql = """select * from servers where enable = '1' ORDER BY groups """ + if kwargs.get("server") is not None: sql = """select * from servers where ip='%s' """ % kwargs.get("server") if kwargs.get("full") is not None: @@ -250,6 +251,8 @@ def select_servers(**kwargs): left join uuid as uuid on user.id = uuid.user_id where uuid.uuid = '%s' and servers.master = 0 and servers.type_ip = 0 and servers.enable = 1 ORDER BY servers.groups """ % kwargs.get('uuid') + if kwargs.get("server") and kwargs.get("keep_alive"): + sql = """select active from servers where ip='%s' """ % kwargs.get("server") try: cur.execute(sql) except sqltool.Error as e: diff --git a/app/templates/ajax/overview.html b/app/templates/ajax/overview.html index ccbbe869..cf76e32f 100644 --- a/app/templates/ajax/overview.html +++ b/app/templates/ajax/overview.html @@ -1,7 +1,12 @@ {% for service in service_status %} - - {{ service.0 }} + + + {{ service.0 }} + {% if service.5.0.0|int() >= 1 %} + + {% endif %} + {% if service.2|int() >= 1 %} diff --git a/app/templates/base.html b/app/templates/base.html index 88981584..eb0edaa1 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -115,7 +115,7 @@ diff --git a/app/tools/keep_alive.py b/app/tools/keep_alive.py index 0d89ad98..cd978e47 100644 --- a/app/tools/keep_alive.py +++ b/app/tools/keep_alive.py @@ -32,8 +32,9 @@ def main(): except CalledProcessError as e: alert = "Try start HAProxy serivce at " + serv[0] funct.logging("localhost", " "+alert, keep_alive=1) + start_command = [] - start_command.append(sql.get_setting('restart_command')) + start_command.append('sudo '+sql.get_setting('restart_command')) funct.ssh_command(serv[0], start_command) time.sleep(30) continue diff --git a/image/pic/shield.png b/image/pic/shield.png new file mode 100644 index 00000000..fc0aae95 Binary files /dev/null and b/image/pic/shield.png differ