mirror of https://github.com/Aidaho12/haproxy-wi
parent
bc6c8371de
commit
b6a75c298e
|
@ -41,8 +41,8 @@ if all(v is None for v in [
|
|||
if not os.path.exists(black_dir):
|
||||
os.makedirs(black_dir)
|
||||
|
||||
white_lists = funct.get_files(dir=white_dir, format="lst")
|
||||
black_lists = funct.get_files(dir=black_dir, format="lst")
|
||||
white_lists = funct.get_files(white_dir, "lst")
|
||||
black_lists = funct.get_files(black_dir, "lst")
|
||||
|
||||
template = template.render(
|
||||
title="Add: ", role=role, user=user, selects=servers, add=form.getvalue('add'), conf_add=form.getvalue('conf'),
|
||||
|
|
|
@ -32,7 +32,7 @@ except Exception as e:
|
|||
if service in ('haproxy', 'nginx', 'keepalived', 'apache'):
|
||||
service_desc = sql.select_service(service)
|
||||
if funct.check_login(service=service_desc.service_id):
|
||||
title = f"Working with {service_desc.service} configuration files"
|
||||
title = f"{service_desc.service} config view page"
|
||||
action = f"config.py?service={service_desc.slug}"
|
||||
configs_dir = funct.get_config_var('configs', 'kp_save_configs_dir')
|
||||
file_format = 'conf'
|
||||
|
@ -60,6 +60,8 @@ if serv is not None and form.getvalue('open') is not None and form.getvalue('new
|
|||
is_serv_protected = sql.is_serv_protected(serv)
|
||||
server_id = sql.select_server_id_by_ip(serv)
|
||||
is_restart = sql.select_service_setting(server_id, service, 'restart')
|
||||
service_desc = sql.select_service(service)
|
||||
title = f'{service_desc.service} config edit page'
|
||||
|
||||
if service == 'keepalived':
|
||||
error = funct.get_config(serv, cfg, keepalived=1)
|
||||
|
|
|
@ -988,7 +988,7 @@ def update_db_v_6_1_4():
|
|||
|
||||
|
||||
def update_ver():
|
||||
query = Version.update(version='6.1.4.0')
|
||||
query = Version.update(version='6.1.5.0')
|
||||
try:
|
||||
query.execute()
|
||||
except Exception:
|
||||
|
|
|
@ -561,6 +561,17 @@ class WafNginx(BaseModel):
|
|||
constraints = [SQL('UNIQUE (server_id)')]
|
||||
|
||||
|
||||
class ServiceStatus(BaseModel):
|
||||
server_id = ForeignKeyField(Server, on_delete='Cascade')
|
||||
service_id = IntegerField()
|
||||
service_check = CharField()
|
||||
status = IntegerField(constraints=[SQL('DEFAULT 1')])
|
||||
|
||||
class Meta:
|
||||
table_name = 'services_statuses'
|
||||
constraints = [SQL('UNIQUE (server_id, service_id, service_check)')]
|
||||
|
||||
|
||||
def create_tables():
|
||||
with conn:
|
||||
conn.create_tables([User, Server, Role, Telegram, Slack, UUID, Token, ApiToken, Groups, UserGroups, ConfigVersion,
|
||||
|
@ -568,4 +579,4 @@ def create_tables():
|
|||
PortScannerSettings, PortScannerPorts, PortScannerHistory, ProvidersCreds, ServiceSetting,
|
||||
ProvisionedServers, MetricsHttpStatus, SMON, WafRules, Alerts, GeoipCodes, NginxMetrics,
|
||||
SystemInfo, Services, UserName, GitSetting, CheckerSetting, ApacheMetrics, ProvisionParam,
|
||||
WafNginx])
|
||||
WafNginx, ServiceStatus])
|
||||
|
|
77
app/funct.py
77
app/funct.py
|
@ -3,6 +3,8 @@ import cgi
|
|||
import os
|
||||
import sys
|
||||
import re
|
||||
import json
|
||||
import http.cookies
|
||||
|
||||
|
||||
def is_ip_or_dns(server_from_request: str) -> str:
|
||||
|
@ -58,7 +60,7 @@ def get_config_var(sec, var):
|
|||
return config.get(sec, var)
|
||||
except Exception:
|
||||
print('Content-type: text/html\n')
|
||||
print('<center><div class="alert alert-danger">Check the config file. Presence section %s and parameter %s</div>' % (sec, var))
|
||||
print(f'<center><div class="alert alert-danger">Check the config file. Presence section {sec} and parameter {var}</div>')
|
||||
return
|
||||
|
||||
|
||||
|
@ -108,7 +110,6 @@ def get_data(log_type, **kwargs):
|
|||
|
||||
def get_user_group(**kwargs):
|
||||
import sql
|
||||
import http.cookies
|
||||
user_group = ''
|
||||
|
||||
try:
|
||||
|
@ -130,7 +131,6 @@ def get_user_group(**kwargs):
|
|||
|
||||
def logging(server_ip, action, **kwargs):
|
||||
import sql
|
||||
import http.cookies
|
||||
import distro
|
||||
|
||||
login = ''
|
||||
|
@ -288,7 +288,6 @@ def slack_send_mess(mess, **kwargs):
|
|||
|
||||
def check_login(**kwargs):
|
||||
import sql
|
||||
import http.cookies
|
||||
user_uuid = None
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
try:
|
||||
|
@ -325,7 +324,6 @@ def get_user_id(**kwargs):
|
|||
if kwargs.get('login'):
|
||||
return sql.get_user_id_by_username(kwargs.get('login'))
|
||||
|
||||
import http.cookies
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
|
||||
|
@ -337,7 +335,6 @@ def get_user_id(**kwargs):
|
|||
|
||||
def is_admin(**kwargs):
|
||||
import sql
|
||||
import http.cookies
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_id = cookie.get('uuid')
|
||||
try:
|
||||
|
@ -364,8 +361,7 @@ def page_for_admin(**kwargs):
|
|||
|
||||
if not is_admin(level=give_level):
|
||||
print('<meta http-equiv="refresh" content="0; url=/">')
|
||||
import sys
|
||||
sys.exit()
|
||||
return
|
||||
|
||||
|
||||
def return_ssh_keys_path(server_ip, **kwargs):
|
||||
|
@ -439,6 +435,7 @@ def ssh_connect(server_ip):
|
|||
|
||||
def get_config(server_ip, cfg, **kwargs):
|
||||
import sql
|
||||
config_path = ''
|
||||
|
||||
if kwargs.get("keepalived") or kwargs.get("service") == 'keepalived':
|
||||
config_path = sql.get_setting('keepalived_config_path')
|
||||
|
@ -479,7 +476,6 @@ def get_config(server_ip, cfg, **kwargs):
|
|||
|
||||
|
||||
def diff_config(oldcfg, cfg, **kwargs):
|
||||
import http.cookies
|
||||
import sql
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
log_path = get_config_var('main', 'log_path')
|
||||
|
@ -628,7 +624,7 @@ def get_backends_from_config(server_ip, backends=''):
|
|||
format_cfg = 'cfg'
|
||||
|
||||
try:
|
||||
cfg = configs_dir + get_files(dir=configs_dir, format=format_cfg)[0]
|
||||
cfg = configs_dir + get_files(configs_dir, format_cfg)[0]
|
||||
except Exception as e:
|
||||
logging('localhost', str(e), haproxywi=1)
|
||||
try:
|
||||
|
@ -987,9 +983,9 @@ def upload_and_restart(server_ip, cfg, **kwargs):
|
|||
config_path = sql.get_setting('haproxy_config_path')
|
||||
tmp_file = sql.get_setting('tmp_config_path') + "/" + get_data('config') + ".cfg"
|
||||
|
||||
is_docker = sql.select_service_setting(server_id, service, 'dockerized')
|
||||
is_dockerized = sql.select_service_setting(server_id, service, 'dockerized')
|
||||
|
||||
if is_docker == '1':
|
||||
if is_dockerized == '1':
|
||||
service_cont_name = service + '_container_name'
|
||||
container_name = sql.get_setting(service_cont_name)
|
||||
reload_command = " && sudo docker kill -s HUP " + container_name
|
||||
|
@ -1035,7 +1031,7 @@ def upload_and_restart(server_ip, cfg, **kwargs):
|
|||
else:
|
||||
commands = [move_config + reload_or_restart_command]
|
||||
elif service == "nginx":
|
||||
if is_docker == '1':
|
||||
if is_dockerized == '1':
|
||||
check_config = "sudo docker exec -it exec " + container_name + " nginx -t "
|
||||
else:
|
||||
check_config = "sudo nginx -t "
|
||||
|
@ -1049,7 +1045,7 @@ def upload_and_restart(server_ip, cfg, **kwargs):
|
|||
if sql.return_firewall(server_ip):
|
||||
commands[0] += open_port_firewalld(cfg, server_ip=server_ip, service='nginx')
|
||||
elif service == "apache":
|
||||
if is_docker == '1':
|
||||
if is_dockerized == '1':
|
||||
check_config = "sudo docker exec -it exec " + container_name + " sudo apachectl configtest "
|
||||
else:
|
||||
check_config = "sudo apachectl configtest "
|
||||
|
@ -1069,7 +1065,7 @@ def upload_and_restart(server_ip, cfg, **kwargs):
|
|||
else:
|
||||
commands = [check_and_move + reload_or_restart_command]
|
||||
else:
|
||||
if is_docker == '1':
|
||||
if is_dockerized == '1':
|
||||
check_config = "sudo docker exec -it " + container_name + " haproxy -c -f " + tmp_file
|
||||
else:
|
||||
check_config = "sudo " + service_name + " -c -f " + tmp_file
|
||||
|
@ -1224,10 +1220,10 @@ def open_port_firewalld(cfg, server_ip, **kwargs):
|
|||
def check_haproxy_config(server_ip):
|
||||
import sql
|
||||
server_id = sql.select_server_id_by_ip(server_ip=server_ip)
|
||||
is_docker = sql.select_service_setting(server_id, 'haproxy', 'dockerized')
|
||||
is_dockerized = sql.select_service_setting(server_id, 'haproxy', 'dockerized')
|
||||
config_path = sql.get_setting('haproxy_config_path')
|
||||
|
||||
if is_docker == '1':
|
||||
if is_dockerized == '1':
|
||||
container_name = sql.get_setting('haproxy_container_name')
|
||||
commands = ["sudo docker exec -it " + container_name + " haproxy -q -c -f " + config_path]
|
||||
else:
|
||||
|
@ -1301,7 +1297,10 @@ def show_finding_in_config(stdout: str, **kwargs) -> str:
|
|||
return out
|
||||
|
||||
|
||||
def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', hour1='24', minut1='00', service='haproxy', **kwargs):
|
||||
def show_haproxy_log(
|
||||
serv, rows='10', waf='0', grep=None, hour='00',
|
||||
minut='00', hour1='24', minut1='00', service='haproxy', **kwargs
|
||||
) -> str:
|
||||
import sql
|
||||
exgrep = form.getvalue('exgrep')
|
||||
log_file = form.getvalue('file')
|
||||
|
@ -1379,7 +1378,7 @@ def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', h
|
|||
user_grep = ''
|
||||
|
||||
log_path = get_config_var('main', 'log_path')
|
||||
logs_files = get_files(log_path, format="log")
|
||||
logs_files = get_files(log_path, "log")
|
||||
|
||||
for key, value in logs_files:
|
||||
if int(serv) == key:
|
||||
|
@ -1403,7 +1402,7 @@ def roxy_wi_log(**kwargs):
|
|||
log_path = get_config_var('main', 'log_path')
|
||||
|
||||
if kwargs.get('log_id'):
|
||||
selects = get_files(log_path, format="log")
|
||||
selects = get_files(log_path, "log")
|
||||
for key, value in selects:
|
||||
log_file = kwargs.get('file') + ".log"
|
||||
if log_file == value:
|
||||
|
@ -1495,7 +1494,6 @@ def subprocess_execute(cmd):
|
|||
|
||||
|
||||
def show_backends(server_ip, **kwargs):
|
||||
import json
|
||||
import sql
|
||||
hap_sock_p = sql.get_setting('haproxy_sock_port')
|
||||
cmd = 'echo "show backend" |nc %s %s' % (server_ip, hap_sock_p)
|
||||
|
@ -1520,22 +1518,22 @@ def show_backends(server_ip, **kwargs):
|
|||
return ret
|
||||
|
||||
|
||||
def get_files(dir=get_config_var('configs', 'haproxy_save_configs_dir'), format='cfg'):
|
||||
def get_files(folder=get_config_var('configs', 'haproxy_save_configs_dir'), file_format='cfg'):
|
||||
import glob
|
||||
if format == 'log':
|
||||
if file_format == 'log':
|
||||
file = []
|
||||
else:
|
||||
file = set()
|
||||
return_files = set()
|
||||
i = 0
|
||||
for files in sorted(glob.glob(os.path.join(dir, '*.' + format + '*'))):
|
||||
if format == 'log':
|
||||
for files in sorted(glob.glob(os.path.join(folder, '*.' + file_format + '*'))):
|
||||
if file_format == 'log':
|
||||
file += [(i, files.split('/')[5])]
|
||||
else:
|
||||
file.add(files.split('/')[-1])
|
||||
i += 1
|
||||
files = file
|
||||
if format == 'cfg' or format == 'conf':
|
||||
if file_format == 'cfg' or file_format == 'conf':
|
||||
for file in files:
|
||||
ip = file.split("-")
|
||||
if serv == ip[0]:
|
||||
|
@ -1593,14 +1591,17 @@ def check_new_version(service):
|
|||
if proxy is not None and proxy != '' and proxy != 'None':
|
||||
proxy_dict = {"https": proxy, "http": proxy}
|
||||
response = requests.get(f'https://roxy-wi.org/version/get/{service}', timeout=1, proxies=proxy_dict)
|
||||
if service == 'roxy-wi':
|
||||
requests.get(f'https://roxy-wi.org/version/send/{current_ver}', timeout=1, proxies=proxy_dict)
|
||||
response_status = requests.get(f'https://roxy-wi.org/user-name/{user_name}', timeout=1, proxies=proxy_dict)
|
||||
else:
|
||||
response = requests.get(f'https://roxy-wi.org/version/get/{service}', timeout=1)
|
||||
if service == 'roxy-wi':
|
||||
requests.get(f'https://roxy-wi.org/version/send/{current_ver}', timeout=1)
|
||||
response_status = requests.get(f'https://roxy-wi.org/user-name/{user_name}', timeout=1)
|
||||
|
||||
res = response.content.decode(encoding='UTF-8')
|
||||
if service == 'roxy-wi':
|
||||
try:
|
||||
status = response_status.content.decode(encoding='UTF-8')
|
||||
status = status.split(' ')
|
||||
|
@ -1655,7 +1656,6 @@ def get_hash(value):
|
|||
|
||||
|
||||
def get_users_params(**kwargs):
|
||||
import http.cookies
|
||||
import sql
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
|
||||
|
@ -1667,6 +1667,11 @@ def get_users_params(**kwargs):
|
|||
user_services = sql.select_user_services(user_id)
|
||||
token = sql.get_token(user_uuid.value)
|
||||
except Exception:
|
||||
user = ''
|
||||
role = ''
|
||||
user_uuid = ''
|
||||
user_services = ''
|
||||
token = ''
|
||||
print('<meta http-equiv="refresh" content="0; url=/app/login.py">')
|
||||
|
||||
if kwargs.get('virt') and kwargs.get('haproxy'):
|
||||
|
@ -1693,8 +1698,6 @@ def check_user_group(**kwargs):
|
|||
user_uuid = kwargs.get('user_uuid')
|
||||
user_id = sql.get_user_id_by_uuid(user_uuid)
|
||||
else:
|
||||
import http.cookies
|
||||
import os
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
group = cookie.get('group')
|
||||
|
@ -1825,7 +1828,6 @@ def is_service_active(server_ip: str, service_name: str):
|
|||
|
||||
|
||||
def get_system_info(server_ip: str) -> bool:
|
||||
import json
|
||||
import sql
|
||||
server_ip = is_ip_or_dns(server_ip)
|
||||
if server_ip == '':
|
||||
|
@ -2083,7 +2085,6 @@ def send_message_to_rabbit(message: str, **kwargs) -> None:
|
|||
|
||||
def is_restarted(server_ip, action):
|
||||
import sql
|
||||
import http.cookies
|
||||
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
|
@ -2094,7 +2095,7 @@ def is_restarted(server_ip, action):
|
|||
sys.exit()
|
||||
|
||||
|
||||
def is_not_allowed_to_restart(server_id: int, service: str) -> bool:
|
||||
def is_not_allowed_to_restart(server_id: int, service: str) -> None:
|
||||
import sql
|
||||
is_restart = sql.select_service_setting(server_id, service, 'restart')
|
||||
|
||||
|
@ -2159,11 +2160,11 @@ def send_email(email_to: str, subject: str, message: str) -> None:
|
|||
msg['To'] = email_to
|
||||
|
||||
try:
|
||||
smtpObj = SMTP(mail_smtp_host, mail_smtp_port)
|
||||
smtp_obj = SMTP(mail_smtp_host, mail_smtp_port)
|
||||
if mail_ssl:
|
||||
smtpObj.starttls()
|
||||
smtpObj.login(mail_smtp_user, mail_smtp_password)
|
||||
smtpObj.send_message(msg)
|
||||
smtp_obj.starttls()
|
||||
smtp_obj.login(mail_smtp_user, mail_smtp_password)
|
||||
smtp_obj.send_message(msg)
|
||||
logging('localhost', 'An email has been sent to ' + email_to, haproxywi=1)
|
||||
except Exception as e:
|
||||
logging('localhost', 'error: unable to send email: ' + str(e), haproxywi=1)
|
||||
|
@ -2182,8 +2183,8 @@ def send_email_to_server_group(subject: str, mes: str, group_id: int) -> None:
|
|||
|
||||
|
||||
def alert_routing(
|
||||
server_ip: str, service_id: int, group_id: int, level: str, mes: str, alert_type: str) -> None:
|
||||
import json
|
||||
server_ip: str, service_id: int, group_id: int, level: str, mes: str, alert_type: str
|
||||
) -> None:
|
||||
import sql
|
||||
|
||||
subject: str = level + ': ' + mes
|
||||
|
|
|
@ -20,10 +20,11 @@ serv = funct.is_ip_or_dns(form.getvalue('serv'))
|
|||
service = funct.checkAjaxInput(form.getvalue('service'))
|
||||
autorefresh = 0
|
||||
servers_waf = ()
|
||||
title = "HAProxy servers overview"
|
||||
title = ''
|
||||
cmd = "ps ax |grep -e 'keep_alive.py' |grep -v grep |wc -l"
|
||||
keep_alive, stderr = funct.subprocess_execute(cmd)
|
||||
is_restart = ''
|
||||
service_desc = ''
|
||||
restart_settings = ''
|
||||
|
||||
if service in ('haproxy', 'nginx', 'keepalived', 'apache'):
|
||||
|
@ -177,6 +178,6 @@ template = template.render(
|
|||
h2=1, autorefresh=autorefresh, title=title, role=role, user=user, servers=servers_with_status1,
|
||||
keep_alive=''.join(keep_alive), serv=serv, service=service, services=services, user_services=user_services,
|
||||
docker_settings=docker_settings, user_status=user_status, user_plan=user_plan, servers_waf=servers_waf,
|
||||
restart_settings=restart_settings, token=token
|
||||
restart_settings=restart_settings, service_desc=service_desc, token=token
|
||||
)
|
||||
print(template)
|
||||
|
|
175
app/options.py
175
app/options.py
|
@ -2,6 +2,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import http.cookies
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
import funct
|
||||
import sql
|
||||
|
@ -249,8 +253,6 @@ if form.getvalue('table_serv_select') is not None:
|
|||
print(funct.get_all_stick_table())
|
||||
|
||||
if form.getvalue('table_select') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True,
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'], trim_blocks=True, lstrip_blocks=True)
|
||||
table = form.getvalue('table_select')
|
||||
|
@ -302,8 +304,6 @@ if form.getvalue('list_serv_select') is not None:
|
|||
print(output)
|
||||
|
||||
if form.getvalue('list_select_id') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'], trim_blocks=True, lstrip_blocks=True)
|
||||
template = env.get_template('ajax/list.html')
|
||||
|
@ -378,8 +378,6 @@ if form.getvalue('list_ip_for_add') is not None:
|
|||
service='haproxy')
|
||||
|
||||
if form.getvalue('sessions_select') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True,
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'], trim_blocks=True, lstrip_blocks=True)
|
||||
serv = funct.checkAjaxInput(form.getvalue('sessions_select'))
|
||||
|
@ -592,8 +590,6 @@ if form.getvalue('action_service') is not None:
|
|||
funct.logging('localhost', ' The service ' + serv + ' has been ' + action + 'ed', haproxywi=1, login=1)
|
||||
|
||||
if act == "overviewHapserverBackends":
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('haproxyservers_backends.html')
|
||||
service = form.getvalue('service')
|
||||
|
@ -608,7 +604,7 @@ if act == "overviewHapserverBackends":
|
|||
|
||||
if service != 'nginx' and service != 'apache':
|
||||
try:
|
||||
sections = funct.get_sections(configs_dir + funct.get_files(dir=configs_dir, format=format_file)[0], service=service)
|
||||
sections = funct.get_sections(configs_dir + funct.get_files(configs_dir, format_file)[0], service=service)
|
||||
except Exception as e:
|
||||
funct.logging('localhost', str(e), haproxywi=1)
|
||||
|
||||
|
@ -639,7 +635,7 @@ if form.getvalue('show_userlists'):
|
|||
format_file = 'cfg'
|
||||
|
||||
try:
|
||||
sections = funct.get_userlists(configs_dir + funct.get_files(dir=configs_dir, format=format_file)[0])
|
||||
sections = funct.get_userlists(configs_dir + funct.get_files(configs_dir, format_file)[0])
|
||||
except Exception as e:
|
||||
funct.logging('localhost', str(e), haproxywi=1)
|
||||
try:
|
||||
|
@ -673,8 +669,6 @@ if act == "overviewHapservers":
|
|||
|
||||
if act == "overview":
|
||||
import asyncio
|
||||
import http.cookies
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
async def async_get_overview(serv1, serv2, user_uuid, server_id):
|
||||
user_id = sql.get_user_id_by_uuid(user_uuid)
|
||||
|
@ -753,9 +747,6 @@ if act == "overview":
|
|||
ioloop.close()
|
||||
|
||||
if act == "overviewwaf":
|
||||
import http.cookies
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(
|
||||
loader=FileSystemLoader('templates/ajax'), autoescape=True,
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do']
|
||||
|
@ -846,8 +837,6 @@ if act == "overviewServers":
|
|||
return server_status
|
||||
|
||||
async def get_runner_overviewServers(**kwargs):
|
||||
import http.cookies
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'),
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
||||
template = env.get_template('overviewServers.html')
|
||||
|
@ -933,8 +922,6 @@ if serv is not None and act == "stats":
|
|||
|
||||
data = response.content
|
||||
if form.getvalue('service') == 'nginx':
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/nginx_stats.html')
|
||||
|
||||
|
@ -1226,8 +1213,6 @@ if form.getvalue('servaction') is not None:
|
|||
funct.logging(serv, action)
|
||||
|
||||
if act == "showCompareConfigs":
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/show_compare_configs.html')
|
||||
left = form.getvalue('left')
|
||||
|
@ -1247,8 +1232,6 @@ if act == "showCompareConfigs":
|
|||
print(template)
|
||||
|
||||
if serv is not None and form.getvalue('right') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
left = funct.checkAjaxInput(form.getvalue('left'))
|
||||
right = funct.checkAjaxInput(form.getvalue('right'))
|
||||
|
||||
|
@ -1273,8 +1256,6 @@ if serv is not None and form.getvalue('right') is not None:
|
|||
print(stderr)
|
||||
|
||||
if serv is not None and act == "configShow":
|
||||
import http.cookies
|
||||
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
role_id = sql.get_user_role_by_uuid(user_uuid.value)
|
||||
|
@ -1317,9 +1298,6 @@ if serv is not None and act == "configShow":
|
|||
is_serv_protected = sql.is_serv_protected(serv)
|
||||
server_id = sql.select_server_id_by_ip(serv)
|
||||
is_restart = sql.select_service_setting(server_id, service, 'restart')
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True, trim_blocks=True, lstrip_blocks=True,
|
||||
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
||||
template = env.get_template('config_show.html')
|
||||
|
@ -1351,8 +1329,6 @@ if act == 'configShowFiles':
|
|||
print(return_files)
|
||||
sys.exit()
|
||||
return_files += ' ' + sql.get_setting(service + '_config_path')
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/show_configs_files.html')
|
||||
template = template.render(serv=serv, service=service, return_files=return_files,
|
||||
|
@ -1366,7 +1342,6 @@ if act == 'showRemoteLogFiles':
|
|||
if 'error: ' in return_files:
|
||||
print(return_files)
|
||||
sys.exit()
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/show_log_files.html')
|
||||
|
@ -1408,8 +1383,8 @@ if form.getvalue('master'):
|
|||
commands = [
|
||||
"chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv + " SSH_PORT=" + ssh_port + " router_id=" + router_id
|
||||
+ " ETH=" + ETH + " IP=" + str(IP) + " MASTER=MASTER" + " ETH_SLAVE=" + ETH_SLAVE + " keepalived_path_logs=" + keepalived_path_logs
|
||||
+ " RETURN_TO_MASTER=" + return_to_master + " SYN_FLOOD=" + syn_flood + " HOST=" + str(master)
|
||||
+ " USER=" + str(ssh_user_name) + " PASS='" + str(ssh_user_password) + "' KEY=" + str(ssh_key_name)
|
||||
+ " RETURN_TO_MASTER=" + return_to_master + " SYN_FLOOD=" + syn_flood + " HOST=" + str(master) + " HAPROXY=" + haproxy
|
||||
+ " NGINX=" + nginx + " USER=" + str(ssh_user_name) + " PASS='" + str(ssh_user_password) + "' KEY=" + str(ssh_key_name)
|
||||
]
|
||||
|
||||
output, error = funct.subprocess_execute(commands[0])
|
||||
|
@ -1433,6 +1408,8 @@ if form.getvalue('master_slave'):
|
|||
ETH_SLAVE = form.getvalue('slave_interface')
|
||||
IP = form.getvalue('vrrpip')
|
||||
syn_flood = form.getvalue('syn_flood')
|
||||
haproxy = form.getvalue('hap')
|
||||
nginx = form.getvalue('nginx')
|
||||
router_id = form.getvalue('router_id')
|
||||
script = "install_keepalived.sh"
|
||||
proxy = sql.get_setting('proxy')
|
||||
|
@ -1457,7 +1434,7 @@ if form.getvalue('master_slave'):
|
|||
commands = [
|
||||
"chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv + " SSH_PORT=" + ssh_port + " router_id=" + router_id
|
||||
+ " ETH=" + ETH + " IP=" + IP + " MASTER=BACKUP" + " ETH_SLAVE=" + ETH_SLAVE + " keepalived_path_logs=" + keepalived_path_logs
|
||||
+ " HOST=" + str(slave) + " USER=" + str(ssh_user_name) + " PASS='" + str(ssh_user_password)
|
||||
+ " HAPROXY=" + HAPROXY + " NGINX=" + nginx + " HOST=" + str(slave) + " USER=" + str(ssh_user_name) + " PASS='" + str(ssh_user_password)
|
||||
+ "' KEY=" + str(ssh_key_name)
|
||||
]
|
||||
|
||||
|
@ -1575,6 +1552,7 @@ if form.getvalue('master_slave_nginx'):
|
|||
if form.getvalue('install_grafana'):
|
||||
script = "install_grafana.sh"
|
||||
proxy = sql.get_setting('proxy')
|
||||
host = os.environ.get('HTTP_HOST', '')
|
||||
|
||||
os.system("cp scripts/%s ." % script)
|
||||
|
||||
|
@ -1589,10 +1567,9 @@ if form.getvalue('install_grafana'):
|
|||
|
||||
if error:
|
||||
funct.logging('localhost', error, haproxywi=1)
|
||||
import socket
|
||||
|
||||
print(
|
||||
'success: Grafana and Prometheus servers were installed. You can find Grafana on http://' + socket.gethostname() + ':3000<br>')
|
||||
f'success: Grafana and Prometheus servers were installed. You can find Grafana on http://{host}:3000<br>')
|
||||
else:
|
||||
for line in output:
|
||||
if any(s in line for s in ("Traceback", "FAILED")):
|
||||
|
@ -1603,10 +1580,8 @@ if form.getvalue('install_grafana'):
|
|||
print(output)
|
||||
break
|
||||
else:
|
||||
import socket
|
||||
|
||||
print(
|
||||
'success: Grafana and Prometheus servers were installed. You can find Grafana on http://' + socket.gethostname() + ':3000<br>')
|
||||
f'success: Grafana and Prometheus servers were installed. You can find Grafana on http://{host}:3000<br>')
|
||||
|
||||
os.system("rm -f %s" % script)
|
||||
|
||||
|
@ -1778,8 +1753,6 @@ if form.getvalue('backup') or form.getvalue('deljob') or form.getvalue('backupup
|
|||
else:
|
||||
if not deljob and not update:
|
||||
if sql.insert_backup_job(serv, rserver, rpath, backup_type, time, cred, description):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('new_backup.html')
|
||||
template = template.render(
|
||||
|
@ -1858,8 +1831,6 @@ if form.getvalue('git_backup'):
|
|||
server_id=server_id, service_id=service_id, repo=repo, branch=branch,
|
||||
period=period, cred=cred, description=description
|
||||
):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
gits = sql.select_gits(server_id=server_id, service_id=service_id)
|
||||
sshs = sql.select_ssh()
|
||||
|
||||
|
@ -1914,7 +1885,6 @@ if form.getvalue('table_metrics'):
|
|||
metrics = sql.select_service_table_metrics(service)
|
||||
else:
|
||||
metrics = sql.select_table_metrics()
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('table_metrics.html')
|
||||
|
@ -1923,8 +1893,6 @@ if form.getvalue('table_metrics'):
|
|||
print(template)
|
||||
|
||||
if form.getvalue('metrics_hapwi_ram'):
|
||||
import json
|
||||
|
||||
ip = form.getvalue('ip')
|
||||
metrics = {'chartData': {}}
|
||||
rams = ''
|
||||
|
@ -1956,8 +1924,6 @@ if form.getvalue('metrics_hapwi_cpu'):
|
|||
cpus = ''
|
||||
|
||||
if ip == '1':
|
||||
# cmd = "top -b -n 1 |grep Cpu |awk -F':' '{print $2}'|awk -F' ' 'BEGIN{ORS=\" \";} { for (i=1;i<=NF;i+=2) print $i}'"
|
||||
# metric, error = funct.subprocess_execute(cmd)
|
||||
import psutil
|
||||
|
||||
cpus_list = psutil.cpu_times_percent(interval=1, percpu=False)
|
||||
|
@ -1979,8 +1945,6 @@ if form.getvalue('metrics_hapwi_cpu'):
|
|||
|
||||
metrics['chartData']['cpus'] = cpus
|
||||
|
||||
import json
|
||||
|
||||
print(json.dumps(metrics))
|
||||
|
||||
if form.getvalue('new_metrics'):
|
||||
|
@ -2011,8 +1975,6 @@ if form.getvalue('new_metrics'):
|
|||
metrics['chartData']['sess_rate'] = sess_rate
|
||||
metrics['chartData']['server'] = hostname + ' (' + server + ')'
|
||||
|
||||
import json
|
||||
|
||||
print(json.dumps(metrics))
|
||||
|
||||
if form.getvalue('new_http_metrics'):
|
||||
|
@ -2046,8 +2008,6 @@ if form.getvalue('new_http_metrics'):
|
|||
metrics['chartData']['http_5xx'] = http_5xx
|
||||
metrics['chartData']['server'] = hostname + ' (' + server + ')'
|
||||
|
||||
import json
|
||||
|
||||
print(json.dumps(metrics))
|
||||
|
||||
if any((form.getvalue('new_nginx_metrics'), form.getvalue('new_apache_metrics'), form.getvalue('new_waf_metrics'))):
|
||||
|
@ -2080,8 +2040,6 @@ if any((form.getvalue('new_nginx_metrics'), form.getvalue('new_apache_metrics'),
|
|||
metrics['chartData']['curr_con'] = curr_con
|
||||
metrics['chartData']['server'] = hostname + ' (' + serv + ')'
|
||||
|
||||
import json
|
||||
|
||||
print(json.dumps(metrics))
|
||||
|
||||
if form.getvalue('get_hap_v'):
|
||||
|
@ -2225,7 +2183,7 @@ if form.getvalue('bwlists_delete'):
|
|||
if form.getvalue('get_lists'):
|
||||
lib_path = funct.get_config_var('main', 'lib_path')
|
||||
list_path = lib_path + "/" + sql.get_setting('lists_path') + "/" + form.getvalue('group') + "/" + form.getvalue('color')
|
||||
lists = funct.get_files(dir=list_path, format="lst")
|
||||
lists = funct.get_files(list_path, "lst")
|
||||
for l in lists:
|
||||
print(l)
|
||||
|
||||
|
@ -2296,8 +2254,6 @@ if form.getvalue('newuser') is not None:
|
|||
if funct.check_user_group():
|
||||
if funct.is_admin(level=role_id):
|
||||
if sql.add_user(new_user, email, password, role, activeuser, group):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/new_user.html')
|
||||
|
||||
|
@ -2424,8 +2380,6 @@ if form.getvalue('newserver') is not None:
|
|||
user_status, user_plan = 0, 0
|
||||
funct.logging('localhost', 'Cannot get a user plan: ' + str(e), haproxywi=1)
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/new_server.html')
|
||||
|
||||
|
@ -2504,8 +2458,6 @@ if form.getvalue('newgroup') is not None:
|
|||
print(error_mess)
|
||||
else:
|
||||
if sql.add_group(newgroup, desc):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax/'), autoescape=True)
|
||||
template = env.get_template('/new_group.html')
|
||||
|
||||
|
@ -2550,8 +2502,6 @@ if form.getvalue('new_ssh'):
|
|||
print(error_mess)
|
||||
else:
|
||||
if sql.insert_new_ssh(name, enable, group, username, password):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/new_ssh.html')
|
||||
output_from_parsed_template = template.render(groups=sql.select_groups(), sshs=sql.select_ssh(name=name),
|
||||
|
@ -2621,13 +2571,14 @@ if form.getvalue('ssh_cert'):
|
|||
key = paramiko.pkey.load_private_key(form.getvalue('ssh_cert'))
|
||||
except Exception as e:
|
||||
print('error: Cannot save SSH key file: ', str(e))
|
||||
sys.exit()
|
||||
|
||||
lib_path = funct.get_config_var('main', 'lib_path')
|
||||
full_dir = lib_path + '/keys/'
|
||||
ssh_keys = name + '.pem'
|
||||
|
||||
try:
|
||||
split_name = name.split('_')[1]
|
||||
check_split = name.split('_')[1]
|
||||
split_name = True
|
||||
except Exception:
|
||||
split_name = False
|
||||
|
@ -2644,6 +2595,7 @@ if form.getvalue('ssh_cert'):
|
|||
key.write_private_key_file(ssh_keys)
|
||||
except Exception as e:
|
||||
print('error: Cannot save SSH key file: ', str(e))
|
||||
sys.exit()
|
||||
else:
|
||||
print('success: SSH key has been saved into: %s ' % ssh_keys)
|
||||
|
||||
|
@ -2666,8 +2618,6 @@ if form.getvalue('newtelegram'):
|
|||
print(error_mess)
|
||||
else:
|
||||
if sql.insert_new_telegram(token, channel, group):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/new_telegram.html')
|
||||
output_from_parsed_template = template.render(groups=sql.select_groups(),
|
||||
|
@ -2686,8 +2636,6 @@ if form.getvalue('newslack'):
|
|||
print(error_mess)
|
||||
else:
|
||||
if sql.insert_new_slack(token, channel, group):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/new_slack.html')
|
||||
output_from_parsed_template = template.render(groups=sql.select_groups(),
|
||||
|
@ -2751,7 +2699,6 @@ if form.getvalue('getuserservices'):
|
|||
services = sql.select_services()
|
||||
for g in u_g:
|
||||
groups.append(g.user_group_id)
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/show_user_services.html')
|
||||
|
@ -2764,7 +2711,6 @@ if form.getvalue('getusergroups'):
|
|||
u_g = sql.select_user_groups(user_id)
|
||||
for g in u_g:
|
||||
groups.append(g.user_group_id)
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/show_user_groups.html')
|
||||
|
@ -2801,16 +2747,11 @@ if form.getvalue('changeUserCurrentGroupId') is not None:
|
|||
print('error: Cannot change group')
|
||||
|
||||
if form.getvalue('getcurrentusergroup') is not None:
|
||||
import http.cookies
|
||||
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_id = cookie.get('uuid')
|
||||
group = cookie.get('group')
|
||||
group_id = sql.get_user_id_by_uuid(user_id.value)
|
||||
groups = sql.select_user_groups_with_names(group_id)
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/show_user_current_group.html')
|
||||
template = template.render(groups=groups, group=group.value, id=group_id)
|
||||
|
@ -2846,7 +2787,6 @@ if form.getvalue('newsmon') is not None:
|
|||
|
||||
last_id = sql.insert_smon(server, port, enable, http, uri, body, group, desc, telegram, slack, user_group)
|
||||
if last_id:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
|
||||
template = env.get_template('ajax/show_new_smon.html')
|
||||
template = template.render(
|
||||
|
@ -2868,9 +2808,6 @@ if form.getvalue('smondel') is not None:
|
|||
if form.getvalue('showsmon') is not None:
|
||||
user_group = funct.get_user_group(id=1)
|
||||
sort = form.getvalue('sort')
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
|
||||
template = env.get_template('ajax/smon_dashboard.html')
|
||||
template = template.render(smon=sql.smon_list(user_group), sort=sort)
|
||||
|
@ -2916,17 +2853,14 @@ if form.getvalue('showBytes') is not None:
|
|||
bit_in, stderr = funct.subprocess_execute(cmd)
|
||||
bin_bout.append(bit_in[0])
|
||||
cmd = "echo 'show stat' |nc {} {} |cut -d ',' -f 1-2,10|grep -E '[0-9]'|awk -F',' '{{sum+=$3;}}END{{print sum;}}'".format(serv, port)
|
||||
bout, stderr = funct.subprocess_execute(cmd)
|
||||
bout, stderr1 = funct.subprocess_execute(cmd)
|
||||
bin_bout.append(bout[0])
|
||||
cmd = "echo 'show stat' |nc {} {} |cut -d ',' -f 1-2,5|grep -E '[0-9]'|awk -F',' '{{sum+=$3;}}END{{print sum;}}'".format(serv, port)
|
||||
cin, stderr = funct.subprocess_execute(cmd)
|
||||
cin, stderr2 = funct.subprocess_execute(cmd)
|
||||
bin_bout.append(cin[0])
|
||||
cmd = "echo 'show stat' |nc {} {} |cut -d ',' -f 1-2,8|grep -E '[0-9]'|awk -F',' '{{sum+=$3;}}END{{print sum;}}'".format(serv, port)
|
||||
cout, stderr = funct.subprocess_execute(cmd)
|
||||
cout, stderr3 = funct.subprocess_execute(cmd)
|
||||
bin_bout.append(cout[0])
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
|
||||
template = env.get_template('ajax/bin_bout.html')
|
||||
template = template.render(bin_bout=bin_bout, serv=serv)
|
||||
|
@ -2951,8 +2885,6 @@ if form.getvalue('nginxConnections'):
|
|||
if num == 2:
|
||||
bin_bout.append(line.split(' ')[3])
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/bin_bout.html')
|
||||
template = template.render(bin_bout=bin_bout, serv=serv, service='nginx')
|
||||
|
@ -3139,8 +3071,6 @@ if form.getvalue('scan_ports') is not None:
|
|||
if stderr != '':
|
||||
print(stderr)
|
||||
else:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
|
||||
template = env.get_template('ajax/scan_ports.html')
|
||||
template = template.render(ports=stdout, info=stdout1)
|
||||
|
@ -3165,9 +3095,6 @@ if form.getvalue('viewFirewallRules') is not None:
|
|||
|
||||
IN_public_allow = funct.ssh_command(serv, cmd1, raw=1)
|
||||
output_chain = funct.ssh_command(serv, cmd2, raw=1)
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/firewall_rules.html')
|
||||
template = template.render(input=input_chain2, IN_public_allow=IN_public_allow, output=output_chain)
|
||||
|
@ -3352,8 +3279,6 @@ if form.getvalue('portscanner_history_server_id'):
|
|||
print('ok')
|
||||
|
||||
if form.getvalue('show_versions'):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/check_version.html')
|
||||
template = template.render(versions=funct.versions())
|
||||
|
@ -3392,10 +3317,6 @@ if any((form.getvalue('do_new_name'), form.getvalue('aws_new_name'), form.getval
|
|||
is_add = True
|
||||
|
||||
if is_add:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
import http.cookies
|
||||
import os
|
||||
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
role_id = sql.get_user_role_by_uuid(user_uuid.value)
|
||||
|
@ -3570,9 +3491,6 @@ if form.getvalue('doworkspace'):
|
|||
region, size, privet_net, floating_ip, ssh_ids, ssh_name, workspace, oss, firewall, monitoring,
|
||||
backup, provider, group, 'Creating'
|
||||
):
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
user, user_id, role, token, servers, user_services = funct.get_users_params()
|
||||
new_server = sql.select_provisioned_servers(new=workspace, group=group, type='do')
|
||||
params = sql.select_provisioning_params()
|
||||
|
@ -3666,9 +3584,6 @@ if form.getvalue('awsworkspace'):
|
|||
region, size, public_ip, floating_ip, volume_size, ssh_name, workspace, oss, firewall,
|
||||
provider, group, 'Creating', delete_on_termination, volume_type
|
||||
):
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
user, user_id, role, token, servers, user_services = funct.get_users_params()
|
||||
new_server = sql.select_provisioned_servers(new=workspace, group=group, type='aws')
|
||||
params = sql.select_provisioning_params()
|
||||
|
@ -3940,9 +3855,6 @@ if form.getvalue('gcoreworkspace'):
|
|||
project, region, size, network_type, network_name, volume_size, ssh_name, workspace, oss, firewall,
|
||||
provider, group, 'Creating', delete_on_termination, volume_type
|
||||
):
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
user, user_id, role, token, servers, user_services = funct.get_users_params()
|
||||
new_server = sql.select_provisioned_servers(new=workspace, group=group, type='gcore')
|
||||
params = sql.select_provisioning_params()
|
||||
|
@ -4003,8 +3915,6 @@ if form.getvalue('editAwsServer'):
|
|||
params = sql.select_provisioning_params()
|
||||
providers = sql.select_providers(int(user_group))
|
||||
server = sql.select_gcore_server(server_id=server_id)
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(extensions=["jinja2.ext.do"], loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/provisioning/aws_edit_dialog.html')
|
||||
template = template.render(server=server, providers=providers, params=params)
|
||||
|
@ -4017,8 +3927,6 @@ if form.getvalue('editGcoreServer'):
|
|||
params = sql.select_provisioning_params()
|
||||
providers = sql.select_providers(int(user_group))
|
||||
server = sql.select_gcore_server(server_id=server_id)
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(extensions=["jinja2.ext.do"], loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/provisioning/gcore_edit_dialog.html')
|
||||
template = template.render(server=server, providers=providers, params=params)
|
||||
|
@ -4031,8 +3939,6 @@ if form.getvalue('editDoServer'):
|
|||
params = sql.select_provisioning_params()
|
||||
providers = sql.select_providers(int(user_group))
|
||||
server = sql.select_do_server(server_id=server_id)
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(extensions=["jinja2.ext.do"], loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/provisioning/do_edit_dialog.html')
|
||||
template = template.render(server=server, providers=providers, params=params)
|
||||
|
@ -4071,7 +3977,6 @@ if form.getvalue('edit_aws_provider'):
|
|||
funct.logging('localhost', 'Provider has been renamed. New name is ' + new_name, provisioning=1)
|
||||
|
||||
if form.getvalue('loadservices'):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/load_services.html')
|
||||
services = funct.get_services_status()
|
||||
|
@ -4080,7 +3985,6 @@ if form.getvalue('loadservices'):
|
|||
print(template)
|
||||
|
||||
if form.getvalue('loadchecker'):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True)
|
||||
template = env.get_template('ajax/load_telegram.html')
|
||||
services = funct.get_services_status()
|
||||
|
@ -4134,7 +4038,6 @@ if form.getvalue('loadchecker'):
|
|||
print(template)
|
||||
|
||||
if form.getvalue('load_update_hapwi'):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/load_updatehapwi.html')
|
||||
|
||||
|
@ -4159,7 +4062,6 @@ if form.getvalue('load_update_hapwi'):
|
|||
|
||||
if form.getvalue('loadopenvpn'):
|
||||
import distro
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates'))
|
||||
template = env.get_template('ajax/load_openvpn.html')
|
||||
openvpn_configs = ''
|
||||
|
@ -4197,9 +4099,6 @@ if form.getvalue('check_slack'):
|
|||
funct.slack_send_mess(mess, slack_channel_id=slack_id)
|
||||
|
||||
if form.getvalue('check_rabbitmq_alert'):
|
||||
import json
|
||||
import http.cookies
|
||||
|
||||
try:
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_group_id = cookie.get('group')
|
||||
|
@ -4216,7 +4115,6 @@ if form.getvalue('check_rabbitmq_alert'):
|
|||
print(f'error: Cannot send a message {error}')
|
||||
|
||||
if form.getvalue('check_email_alert'):
|
||||
import http.cookies
|
||||
subject = 'test message'
|
||||
message = 'Test message from Roxy-WI'
|
||||
|
||||
|
@ -4251,7 +4149,7 @@ if form.getvalue('getoption'):
|
|||
for i in options:
|
||||
a[v] = i.options
|
||||
v = v + 1
|
||||
import json
|
||||
|
||||
print(json.dumps(a))
|
||||
|
||||
|
||||
|
@ -4262,8 +4160,6 @@ if form.getvalue('newtoption'):
|
|||
print(error_mess)
|
||||
else:
|
||||
if sql.insert_new_option(option, group):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/new_option.html')
|
||||
|
||||
|
@ -4299,7 +4195,7 @@ if form.getvalue('getsavedserver'):
|
|||
a[v]['value'] = i.server
|
||||
a[v]['desc'] = i.description
|
||||
v = v + 1
|
||||
import json
|
||||
|
||||
print(json.dumps(a))
|
||||
|
||||
|
||||
|
@ -4311,8 +4207,6 @@ if form.getvalue('newsavedserver'):
|
|||
print(error_mess)
|
||||
else:
|
||||
if sql.insert_new_savedserver(savedserver, description, group):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/new_saved_servers.html')
|
||||
|
||||
|
@ -4335,8 +4229,6 @@ if form.getvalue('savedserverdel') is not None:
|
|||
print("Ok")
|
||||
|
||||
if form.getvalue('show_users_ovw') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||
template = env.get_template('/show_users_ovw.html')
|
||||
|
||||
|
@ -4356,8 +4248,6 @@ if form.getvalue('show_users_ovw') is not None:
|
|||
if form.getvalue('serverSettings') is not None:
|
||||
server_id = form.getvalue('serverSettings')
|
||||
service = form.getvalue('serverSettingsService')
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/show_service_settings.html')
|
||||
|
||||
|
@ -4459,9 +4349,7 @@ if act == 'showListOfVersion':
|
|||
if service == 'haproxy':
|
||||
files = funct.get_files()
|
||||
else:
|
||||
files = funct.get_files(dir=configs_dir, format='conf')
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
files = funct.get_files(configs_dir, 'conf')
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
|
||||
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
||||
|
@ -4487,7 +4375,6 @@ if act == 'getSystemInfo':
|
|||
print('error: IP or DNS name is not valid')
|
||||
sys.exit()
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
|
||||
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
||||
env.globals['string_to_dict'] = funct.string_to_dict
|
||||
|
@ -4518,8 +4405,6 @@ if act == 'updateSystemInfo':
|
|||
|
||||
sql.delete_system_info(server_id)
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
|
||||
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
|
||||
env.globals['string_to_dict'] = funct.string_to_dict
|
||||
|
@ -4550,7 +4435,9 @@ if act == 'findInConfigs':
|
|||
print(return_find)
|
||||
|
||||
if act == 'check_service':
|
||||
import http.cookies
|
||||
import socket
|
||||
from contextlib import closing
|
||||
|
||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||
user_uuid = cookie.get('uuid')
|
||||
user_id = sql.get_user_id_by_uuid(user_uuid.value)
|
||||
|
@ -4571,9 +4458,6 @@ if act == 'check_service':
|
|||
print('down')
|
||||
if '2' in user_services:
|
||||
if service == 'nginx':
|
||||
import socket
|
||||
from contextlib import closing
|
||||
|
||||
nginx_stats_port = sql.get_setting('nginx_stats_port')
|
||||
|
||||
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
|
||||
|
@ -4588,9 +4472,6 @@ if act == 'check_service':
|
|||
print('down')
|
||||
if '4' in user_services:
|
||||
if service == 'apache':
|
||||
import socket
|
||||
from contextlib import closing
|
||||
|
||||
apache_stats_port = sql.get_setting('apache_stats_port')
|
||||
|
||||
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
|
||||
|
@ -4605,8 +4486,6 @@ if act == 'check_service':
|
|||
print('down' + str(e))
|
||||
|
||||
if form.getvalue('show_sub_ovw'):
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||
template = env.get_template('ajax/show_sub_ovw.html')
|
||||
template = template.render(sub=sql.select_user_all())
|
||||
|
|
105
app/overview.py
105
app/overview.py
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import psutil
|
||||
|
||||
import funct
|
||||
import sql
|
||||
|
@ -13,57 +14,50 @@ print('Content-type: text/html\n')
|
|||
|
||||
funct.check_login()
|
||||
|
||||
grafana = 0
|
||||
metrics_worker = 0
|
||||
checker_worker = 0
|
||||
is_checker_worker = 0
|
||||
is_metrics_worker = 0
|
||||
servers_group = []
|
||||
host = os.environ.get('HTTP_HOST', '')
|
||||
|
||||
try:
|
||||
user, user_id, role, token, servers, user_services = funct.get_users_params()
|
||||
groups = sql.select_groups()
|
||||
user_group = funct.get_user_group(id=1)
|
||||
|
||||
if (role == 2 or role == 3) and int(user_group) != 1:
|
||||
servers_for_grep = ''
|
||||
i = 1
|
||||
servers_len = len(servers)
|
||||
|
||||
for s in servers:
|
||||
if i != servers_len:
|
||||
servers_for_grep += s[2] + '\|'
|
||||
else:
|
||||
servers_for_grep += s[2]
|
||||
servers_group.append(s[2])
|
||||
|
||||
i += 1
|
||||
is_checker_worker = len(sql.select_all_alerts(group=user_group))
|
||||
is_metrics_worker = len(sql.select_servers_metrics_for_master(group=user_group))
|
||||
|
||||
cmd = "ps ax |grep '[m]etrics_worker\|[m]etrics_waf_worker.py\|[m]etrics_nginx_worker.py'|grep '%s' |wc -l" % servers_for_grep
|
||||
metrics_worker, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "ps ax |grep '[c]hecker_worker\|[c]hecker_nginx\|[c]hecker_apache\|[c]hecker_keepalived'|grep -v grep |grep '%s' |wc -l" % servers_for_grep
|
||||
checker_worker, stderr = funct.subprocess_execute(cmd)
|
||||
i = 0
|
||||
for s in sql.select_all_alerts(group=user_group):
|
||||
i += 1
|
||||
is_checker_worker = i
|
||||
is_metrics_workers = sql.select_servers_metrics_for_master(group=user_group)
|
||||
i = 0
|
||||
for s in is_metrics_workers:
|
||||
i += 1
|
||||
is_metrics_worker = i
|
||||
grafana = ''
|
||||
prometheus = ''
|
||||
host = ''
|
||||
for pids in psutil.pids():
|
||||
if pids < 300:
|
||||
continue
|
||||
try:
|
||||
pid = psutil.Process(pids)
|
||||
cmdline_out = pid.cmdline()
|
||||
if len(cmdline_out) > 2:
|
||||
if 'checker_' in cmdline_out[1]:
|
||||
if len(servers_group) > 0:
|
||||
if cmdline_out[2] in servers_group:
|
||||
checker_worker += 1
|
||||
else:
|
||||
cmd = "ps ax |grep '[m]etrics_worker\|[m]etrics_waf_worker.py\|[m]etrics_nginx_worker.py' |wc -l"
|
||||
metrics_worker, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "ps ax |grep '[c]hecker_worker\|[c]hecker_nginx\|[c]hecker_apache\|[c]hecker_keepalived' |wc -l"
|
||||
checker_worker, stderr = funct.subprocess_execute(cmd)
|
||||
i = 0
|
||||
for s in sql.select_all_alerts():
|
||||
i += 1
|
||||
is_checker_worker = i
|
||||
is_metrics_workers = sql.select_servers_metrics_for_master()
|
||||
i = 0
|
||||
for s in is_metrics_workers:
|
||||
i += 1
|
||||
is_metrics_worker = i
|
||||
cmd = "ps ax |egrep [g]rafana|wc -l"
|
||||
grafana, stderr = funct.subprocess_execute(cmd)
|
||||
host = os.environ.get('HTTP_HOST', '')
|
||||
checker_worker += 1
|
||||
elif 'metrics_' in cmdline_out[1]:
|
||||
if len(servers_group) > 0:
|
||||
if cmdline_out[2] in servers_group:
|
||||
metrics_worker += 1
|
||||
else:
|
||||
metrics_worker += 1
|
||||
if len(servers_group) == 0:
|
||||
if 'grafana' in cmdline_out[1]:
|
||||
grafana += 1
|
||||
except psutil.NoSuchProcess:
|
||||
pass
|
||||
|
||||
cmd = "systemctl is-active roxy-wi-metrics"
|
||||
metrics_master, stderr = funct.subprocess_execute(cmd)
|
||||
|
@ -78,41 +72,32 @@ try:
|
|||
cmd = "systemctl is-active roxy-wi-socket"
|
||||
socket, stderr = funct.subprocess_execute(cmd)
|
||||
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
role = ''
|
||||
user = ''
|
||||
users = ''
|
||||
groups = ''
|
||||
roles = ''
|
||||
metrics_master = ''
|
||||
metrics_worker = ''
|
||||
checker_master = ''
|
||||
checker_worker = ''
|
||||
keep_alive = ''
|
||||
smon = ''
|
||||
grafana = ''
|
||||
socket = ''
|
||||
versions = ''
|
||||
haproxy_wi_log = ''
|
||||
servers = ''
|
||||
stderr = ''
|
||||
is_checker_worker = ''
|
||||
is_metrics_worker = ''
|
||||
token = ''
|
||||
|
||||
print(str(e))
|
||||
|
||||
rendered_template = template.render(
|
||||
h2=1, autorefresh=1, title="Overview", role=role, user=user, groups=groups, roles=sql.select_roles(),
|
||||
metrics_master=''.join(metrics_master), metrics_worker=''.join(metrics_worker), checker_master=''.join(checker_master),
|
||||
checker_worker=''.join(checker_worker), keep_alive=''.join(keep_alive), smon=''.join(smon),
|
||||
port_scanner=''.join(port_scanner), grafana=''.join(grafana), socket=''.join(socket),
|
||||
roxy_wi_log_id=funct.roxy_wi_log(log_id=1, file="roxy-wi-", with_date=1),
|
||||
metrics_log_id=funct.roxy_wi_log(log_id=1, file="metrics", with_date=1),
|
||||
checker_log_id=funct.roxy_wi_log(log_id=1, file="checker", with_date=1),
|
||||
metrics_master=''.join(metrics_master), metrics_worker=metrics_worker, checker_master=''.join(checker_master),
|
||||
checker_worker=checker_worker, keep_alive=''.join(keep_alive), smon=''.join(smon),
|
||||
port_scanner=''.join(port_scanner), grafana=grafana, socket=''.join(socket),
|
||||
roxy_wi_log_id=funct.roxy_wi_log(log_id=1, file="roxy-wi-"),
|
||||
metrics_log_id=funct.roxy_wi_log(log_id=1, file="metrics"),
|
||||
checker_log_id=funct.roxy_wi_log(log_id=1, file="checker"),
|
||||
keep_alive_log_id=funct.roxy_wi_log(log_id=1, file="keep_alive"),
|
||||
socket_log_id=funct.roxy_wi_log(log_id=1, file="socket"),
|
||||
metrics_error_log_id=funct.roxy_wi_log(log_id=1, file="metrics-error"), error=stderr,
|
||||
haproxy_wi_log=funct.roxy_wi_log(), servers=servers, is_checker_worker=is_checker_worker,
|
||||
socket_log_id=funct.roxy_wi_log(log_id=1, file="socket"), error=stderr,
|
||||
roxy_wi_log=funct.roxy_wi_log(), servers=servers, is_checker_worker=is_checker_worker,
|
||||
is_metrics_worker=is_metrics_worker, host=host, user_services=user_services, token=token
|
||||
)
|
||||
print(rendered_template)
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
---
|
||||
- name: restart keepalived
|
||||
service: name=keepalived state=restarted
|
||||
|
||||
- name: restart rsyslog
|
||||
service: name=restart state=restarted
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
global_defs {
|
||||
router_id LVS_DEVEL
|
||||
}
|
||||
{%- if NGINX == '1' %}
|
||||
{% set check_service = 'nginx' %}
|
||||
{% else %}
|
||||
{% set check_service = 'haproxy' %}
|
||||
{% endif %}
|
||||
#health-check for keepalive
|
||||
vrrp_script chk_haproxy {
|
||||
script "systemctl is-active --quiet haproxy"
|
||||
vrrp_script chk_service {
|
||||
script "systemctl is-active --quiet {{ check_service }}"
|
||||
interval 2
|
||||
weight 3
|
||||
}
|
||||
|
@ -16,7 +21,7 @@ vrrp_instance VI_1 {
|
|||
|
||||
#check if we are still running
|
||||
track_script {
|
||||
chk_haproxy
|
||||
chk_service
|
||||
}
|
||||
|
||||
advert_int 1
|
||||
|
|
|
@ -21,6 +21,8 @@ do
|
|||
RETURN_TO_MASTER) RETURN_TO_MASTER=${VALUE} ;;
|
||||
ADD_VRRP) ADD_VRRP=${VALUE} ;;
|
||||
SSH_PORT) SSH_PORT=${VALUE} ;;
|
||||
HAPROXY) HAPROXY=${VALUE} ;;
|
||||
NGINX) NGINX=${VALUE} ;;
|
||||
*)
|
||||
esac
|
||||
done
|
||||
|
@ -36,9 +38,9 @@ PWD=$PWD/scripts/ansible/
|
|||
echo "$HOST ansible_port=$SSH_PORT" > $PWD/$HOST
|
||||
|
||||
if [[ $KEY == "" ]]; then
|
||||
ansible-playbook $PWD/roles/keepalived.yml -e "ansible_user=$USER ansible_ssh_pass='$PASS' variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH ETH_SLAVE=$ETH_SLAVE keepalived_path_logs=$keepalived_path_logs IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP router_id=$router_id SSH_PORT=$SSH_PORT" -i $PWD/$HOST
|
||||
ansible-playbook $PWD/roles/keepalived.yml -e "ansible_user=$USER ansible_ssh_pass='$PASS' variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH ETH_SLAVE=$ETH_SLAVE keepalived_path_logs=$keepalived_path_logs IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP router_id=$router_id HAPROXY=$HAPROXY NGINX=$NGINX SSH_PORT=$SSH_PORT" -i $PWD/$HOST
|
||||
else
|
||||
ansible-playbook $PWD/roles/keepalived.yml --key-file $KEY -e "ansible_user=$USER variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH ETH_SLAVE=$ETH_SLAVE keepalived_path_logs=$keepalived_path_logs IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP router_id=$router_id SSH_PORT=$SSH_PORT" -i $PWD/$HOST
|
||||
ansible-playbook $PWD/roles/keepalived.yml --key-file $KEY -e "ansible_user=$USER variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH ETH_SLAVE=$ETH_SLAVE keepalived_path_logs=$keepalived_path_logs IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP router_id=$router_id HAPROXY=$HAPROXY NGINX=$NGINX SSH_PORT=$SSH_PORT" -i $PWD/$HOST
|
||||
fi
|
||||
|
||||
if [ $? -gt 0 ]
|
||||
|
|
24
app/sql.py
24
app/sql.py
|
@ -3765,3 +3765,27 @@ def select_service(slug: str) -> str:
|
|||
return 'there is no service'
|
||||
else:
|
||||
return query_res
|
||||
|
||||
|
||||
def select_checker_service_status(server_id: int, service_id: int, service_check: str) -> int:
|
||||
try:
|
||||
service_check_status = ServiceStatus.get(
|
||||
(ServiceStatus.server_id == server_id)
|
||||
& (ServiceStatus.service_id == service_id)
|
||||
& (ServiceStatus.service_check == service_check)
|
||||
).status
|
||||
except Exception as e:
|
||||
return out_error(e)
|
||||
else:
|
||||
return service_check_status
|
||||
|
||||
|
||||
def inset_or_update_service_status(
|
||||
server_id: int, service_id: int, service_check: str, status: int
|
||||
) -> None:
|
||||
try:
|
||||
ServiceStatus.insert(
|
||||
server_id=server_id, service_id=service_id, service_check=service_check, status=status
|
||||
).on_conflict('replace').execute()
|
||||
except Exception as e:
|
||||
out_error(e)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<p class="accordion-expand-holder">
|
||||
{% if role <= 3 %}
|
||||
{% if not is_serv_protected or role <= 2 %}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Edit this run config" href="config.py?service={{service}}&serv={{serv}}&open=open&config_file_name={{config_file_name}}">Edit</a>
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Edit this run config" id="edit_link" href="config.py?service={{service}}&serv={{serv}}&open=open&config_file_name={{config_file_name}}">Edit</a>
|
||||
{% if service == 'haproxy' %}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Add proxy" href="add.py#proxy">Add</a>
|
||||
{% elif service == 'keepalived' %}
|
||||
|
@ -11,7 +11,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<a class="accordion-expand-all ui-button ui-widget ui-corner-all" href="#">Expand all</a>
|
||||
<a class="accordion-expand-all ui-button ui-widget ui-corner-all" id="expand_link" href="#">Expand all</a>
|
||||
<button id="raw">Raw</button>
|
||||
<button id="according" style="display: none;">According</button>
|
||||
</p>
|
||||
|
@ -383,3 +383,25 @@
|
|||
<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will be reconfigured automatically</div>
|
||||
</center>
|
||||
{% endif %}
|
||||
<script>
|
||||
{% if role <= 3 %}
|
||||
{% if not is_serv_protected or role <= 2 %}
|
||||
$(document).bind('keydown', 'e', function (){
|
||||
window.location = document.getElementById('edit_link').href;
|
||||
});
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
$(document).on('keydown', null, 'r', raw_button);
|
||||
function raw_button(event) {
|
||||
$("#raw").trigger("click");
|
||||
}
|
||||
$(document).on('keydown', null, 'a', according_button);
|
||||
function according_button(event) {
|
||||
$("#according").click();
|
||||
}
|
||||
$(document).on('keydown', null, 'x', expand_button);
|
||||
function expand_button(event) {
|
||||
$("#expand_link").click();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<table style="min-width: 40%;" id="body_table_metrics">
|
||||
{% if service == 'haproxy' %}
|
||||
<tr>
|
||||
<th class="padding10 first-collumn overviewTr" rowspan=2>Server</th>
|
||||
<th colspan=3>Average sessions</th>
|
||||
|
@ -37,4 +38,30 @@
|
|||
<td>{{ state.13 }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<th class="padding10 first-collumn overviewTr" rowspan=2>Server</th>
|
||||
<th colspan=3>Average connections</th>
|
||||
<th colspan=3>Peak connections</th>
|
||||
</tr>
|
||||
<tr class="overviewHead">
|
||||
<th>1 hour</th>
|
||||
<th>24 hours</th>
|
||||
<th>3 days</th>
|
||||
<th>1 hour</th>
|
||||
<th>24 hours</th>
|
||||
<th>3 days</th>
|
||||
</tr>
|
||||
{% for state in table_stat %}
|
||||
<tr class="{{ loop.cycle('odd', 'even') }}">
|
||||
<td class="padding10 first-collumn"><span title="{{ state.0 }}">{{ state.1 }}</span></td>
|
||||
<td>{{ state.2 }}</td>
|
||||
<td>{{ state.3 }}</td>
|
||||
<td>{{ state.4 }}</td>
|
||||
<td>{{ state.5 }}</td>
|
||||
<td>{{ state.6 }}</td>
|
||||
<td>{{ state.7 }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
|
@ -1,6 +1,6 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<title>{{title}} - Roxy-WI</title>
|
||||
<title>{{title}}</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
|
@ -49,6 +49,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<input type="hidden" id="token" value="{{ token }}">
|
||||
<script>show_version();</script>
|
||||
<div class="top-menu">
|
||||
<div class="LogoText">
|
||||
<span id="logo_text">
|
||||
|
@ -70,13 +71,13 @@
|
|||
<li><a href="/app/config.py?service=haproxy" title="Working with HAProxy configs" class="edit head-submenu">Configs</a></li>
|
||||
<li><a href="/app/statsview.py?service=haproxy" title="HAProxy statistics " class="stats head-submenu">Stats</a></li>
|
||||
<li><a href="/app/logs.py?service=haproxy" title="HAProxy logs " class="logs head-submenu">Logs</a></li>
|
||||
<li><a href="/app/runtimeapi.py" title="Runtime API - Roxy-WI" class="runtime head-submenu">Runtime API</a></li>
|
||||
<li><a href="/app/runtimeapi.py" title="Runtime API" class="runtime head-submenu">Runtime API</a></li>
|
||||
<li><a href="/app/metrics.py?service=haproxy" title="HAProxy's metrics" class="metrics head-submenu">Metrics</a></li>
|
||||
{% if role <= 3 %}
|
||||
<li><a href="/app/add.py#proxy" title="Add proxy: Create proxy - Roxy-WI" class="add-proxy head-submenu" id="add1">Add proxy</a></li>
|
||||
<li><a href="/app/add.py#proxy" title="Add proxy: Create proxy" class="add-proxy head-submenu" id="add1">Add proxy</a></li>
|
||||
<li><a href="/app/versions.py?service=haproxy" title="Working with versions HAProxy configs" class="version head-submenu">Versions</a></li>
|
||||
<li><a href="/app/add.py#ssl" title="Add proxy: Upload SSL certificates - Roxy-WI" class="cert head-submenu" id="add3">SSL</a></li>
|
||||
<li><a href="/app/add.py#lists" title="Add proxy: Create and upload whitelists or blacklists - Roxy-WI" class="lists head-submenu" id="add7">Lists</a></li>
|
||||
<li><a href="/app/add.py#ssl" title="Add proxy: Upload SSL certificates" class="cert head-submenu" id="add3">SSL</a></li>
|
||||
<li><a href="/app/add.py#lists" title="Add proxy: Create and upload whitelists or blacklists" class="lists head-submenu" id="add7">Lists</a></li>
|
||||
<li><a href="/app/waf.py?service=haproxy" title="Web application firewall" class="waf-menu head-submenu">WAF</a> </li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -93,7 +94,7 @@
|
|||
<li><a href="/app/metrics.py?service=nginx" title="NGINX's metrics" class="metrics head-submenu">Metrics</a></li>
|
||||
{% if role <= 3 %}
|
||||
<li><a href="/app/versions.py?service=nginx" title="Working with versions NGINX configs" class="version head-submenu">Versions</a></li>
|
||||
<li><a href="/app/add.py?service=nginx#ssl" title="Add proxy: Upload SSL certificates - Roxy-WI" class="cert head-submenu" id="add3">SSL</a></li>
|
||||
<li><a href="/app/add.py?service=nginx#ssl" title="Add proxy: Upload SSL certificates" class="cert head-submenu" id="add3">SSL</a></li>
|
||||
<li><a href="/app/waf.py?service=nginx" title="Web application firewall" class="waf-menu head-submenu">WAF</a> </li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -110,7 +111,7 @@
|
|||
<li><a href="/app/metrics.py?service=apache" title="Apache's metrics" class="metrics head-submenu">Metrics</a></li>
|
||||
{% if role <= 3 %}
|
||||
<li><a href="/app/versions.py?service=apache" title="Working with versions Apache configs" class="version head-submenu">Versions</a></li>
|
||||
<li><a href="/app/add.py?service=apache#ssl" title="Add proxy: Upload SSL certificates - Roxy-WI" class="cert head-submenu" id="add3">SSL</a></li>
|
||||
<li><a href="/app/add.py?service=apache#ssl" title="Add proxy: Upload SSL certificates" class="cert head-submenu" id="add3">SSL</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -121,7 +122,7 @@
|
|||
<a href="/app/hapservers.py?service=keepalived" title="Overview Keepalived servers" class="ha">Keepalived</a>
|
||||
<ul class="v_menu">
|
||||
<li><a href="/app/hapservers.py?service=keepalived" title="Overview Keepalived servers" class="overview-link head-submenu">Overview</a> </li>
|
||||
<li><a href="/app/ha.py" title="Create and configure HA cluster - Roxy-WI" class="keepalived head-submenu">HA</a></li>
|
||||
<li><a href="/app/ha.py" title="Create and configure HA cluster" class="keepalived head-submenu">HA</a></li>
|
||||
<li><a href="/app/config.py?service=keepalived" title="Working with Keepalived configs" class="edit head-submenu">Configs</a></li>
|
||||
<li><a href="/app/logs.py?service=keepalived" title="Keepalived logs " class="logs head-submenu">Logs</a></li>
|
||||
<li><a href="/app/versions.py?service=keepalived" title="Working with versions Keepalived configs" class="version head-submenu keepalived_versions">Versions</a></li>
|
||||
|
@ -146,16 +147,16 @@
|
|||
<li class="p_menu">
|
||||
<a title="Servers manage" class="runtime">Servers</a>
|
||||
<ul class="v_menu">
|
||||
<li><a href="/app/servers.py#users" title="Servers: Manage users - Roxy-WI" class="users head-submenu">Users</a></li>
|
||||
<li><a href="/app/servers.py#servers" title="Servers: Manage servers - Roxy-WI" class="runtime servers head-submenu">Servers</a></li>
|
||||
<li><a href="/app/servers.py#ssh" title="Servers: Manage SSH credentials - Roxy-WI" class="admin ssh head-submenu">SSH credentials</a></li>
|
||||
<li><a href="/app/servers.py#checker" title="Servers: Manage Checker - Roxy-WI" class="checker head-submenu">Checker</a></li>
|
||||
<li><a href="/app/servers.py#settings" title="Servers: Manage Roxy-WI settings - Roxy-WI" class="settings head-submenu">Settings</a></li>
|
||||
<li><a href="/app/servers.py#installproxy" title="Servers: Proxy service installation - Roxy-WI" class="hap-menu installproxy head-submenu">Proxy installation</a> </li>
|
||||
<li><a href="/app/servers.py#installmon" title="Servers: Monitoring service installation - Roxy-WI" class="hap1 installmon head-submenu">Monitoring installation</a> </li>
|
||||
<li><a href="/app/provisioning.py" title="Servers: Provisioning - Roxy-WI" class="hap1 head-submenu">Server provisioning</a> </li>
|
||||
<li><a href="/app/viewlogs.py?type=2" title="Servers: View internal logs - Roxy-WI" class="logs head-submenu">Internal logs</a></li>
|
||||
<li><a href="/app/servers.py#backup" title="Servers: Backup configs - Roxy-WI" class="backup head-submenu">Backups</a> </li>
|
||||
<li><a href="/app/servers.py#users" title="Servers: Manage users" class="users head-submenu">Users</a></li>
|
||||
<li><a href="/app/servers.py#servers" title="Servers: Manage servers" class="runtime servers head-submenu">Servers</a></li>
|
||||
<li><a href="/app/servers.py#ssh" title="Servers: Manage SSH credentials" class="admin ssh head-submenu">SSH credentials</a></li>
|
||||
<li><a href="/app/servers.py#checker" title="Servers: Manage Checker" class="checker head-submenu">Checker</a></li>
|
||||
<li><a href="/app/servers.py#settings" title="Servers: Manage Roxy-WI settings" class="settings head-submenu">Settings</a></li>
|
||||
<li><a href="/app/servers.py#installproxy" title="Servers: Proxy service installation" class="hap-menu installproxy head-submenu">Proxy installation</a> </li>
|
||||
<li><a href="/app/servers.py#installmon" title="Servers: Monitoring service installation" class="hap1 installmon head-submenu">Monitoring installation</a> </li>
|
||||
<li><a href="/app/provisioning.py" title="Servers: Provisioning" class="hap1 head-submenu">Server provisioning</a> </li>
|
||||
<li><a href="/app/viewlogs.py?type=2" title="Servers: View internal logs" class="logs head-submenu">Internal logs</a></li>
|
||||
<li><a href="/app/servers.py#backup" title="Servers: Backup configs" class="backup head-submenu">Backups</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -163,15 +164,15 @@
|
|||
<li class="p_menu">
|
||||
<a title="Admin area" class="admin">Admin area</a>
|
||||
<ul class="v_menu">
|
||||
<li><a href="/app/users.py#users" title="Admin area: Manage users - Roxy-WI" class="users head-submenu">Users</a></li>
|
||||
<li><a href="/app/users.py#groups" title="Admin area: Manage groups - Roxy-WI" class="group groups head-submenu">Groups</a></li>
|
||||
<li><a href="/app/users.py#servers" title="Admin area: Manage servers - Roxy-WI" class="runtime servers head-submenu">Servers</a></li>
|
||||
<li><a href="/app/users.py#ssh" title="Admin area: Manage SSH credentials - Roxy-WI" class="admin ssh head-submenu">SSH credentials</a></li>
|
||||
<li><a href="/app/users.py#checker" title="Admin area: Checker - Roxy-WI" class="checker head-submenu">Checker</a></li>
|
||||
<li><a href="/app/users.py#settings" title="Admin area: Manage Roxy-WI settings - Roxy-WI" class="settings head-submenu">Settings</a></li>
|
||||
<li><a href="/app/users.py#services" title="Admin area: Manage Roxy-WI services - Roxy-WI" class="services head-submenu">Services</a></li>
|
||||
<li><a href="/app/viewlogs.py" title="Admin area: View internal logs - Roxy-WI" class="logs head-submenu">Internal logs</a></li>
|
||||
<li><a href="/app/users.py#updatehapwi" title="Admin area: Update Roxy-WI - Roxy-WI" class="upload updatehapwi head-submenu">Update</a></li>
|
||||
<li><a href="/app/users.py#users" title="Admin area: Manage users" class="users head-submenu">Users</a></li>
|
||||
<li><a href="/app/users.py#groups" title="Admin area: Manage groups" class="group groups head-submenu">Groups</a></li>
|
||||
<li><a href="/app/users.py#servers" title="Admin area: Manage servers" class="runtime servers head-submenu">Servers</a></li>
|
||||
<li><a href="/app/users.py#ssh" title="Admin area: Manage SSH credentials" class="admin ssh head-submenu">SSH credentials</a></li>
|
||||
<li><a href="/app/users.py#checker" title="Admin area: Checker" class="checker head-submenu">Checker</a></li>
|
||||
<li><a href="/app/users.py#settings" title="Admin area: Manage Roxy-WI settings" class="settings head-submenu">Settings</a></li>
|
||||
<li><a href="/app/users.py#services" title="Admin area: Manage Roxy-WI services" class="services head-submenu">Services</a></li>
|
||||
<li><a href="/app/viewlogs.py" title="Admin area: View internal logs" class="logs head-submenu">Internal logs</a></li>
|
||||
<li><a href="/app/users.py#updatehapwi" title="Admin area: Update Roxy-WI" class="upload updatehapwi head-submenu">Update</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
{% endif %}
|
||||
</center>
|
||||
<script>
|
||||
if (cur_url[1].split('&')[1] == 'showMap') {
|
||||
if (cur_url[1].split('&')[2] == 'showMap') {
|
||||
showMap();
|
||||
}
|
||||
if (cur_url[1].split('&')[1] == 'showCompare' || cur_url[1].split('&')[2] == 'showCompare') {
|
||||
|
@ -170,6 +170,20 @@
|
|||
</style>
|
||||
<script>
|
||||
myCodeMirror.refresh();
|
||||
$(document).bind('keydown', 'ctrl+s', function (){
|
||||
$("[type='submit'][value='save']").click();
|
||||
});
|
||||
$(document).bind('keydown', 'ctrl+d', function (){
|
||||
$("[type='submit'][value='test']").click();
|
||||
});
|
||||
$(document).bind('keydown', 'ctrl+e', function (){
|
||||
$("[type='submit'][value='reload']").click();
|
||||
});
|
||||
{% if is_restart|int == 0 %}
|
||||
$(document).bind('keydown', 'ctrl+r', function (){
|
||||
$("[type='submit'][value='restart']").click();
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
</table>
|
||||
<div id="ajax"></div>
|
||||
<div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
Read <a href="https://roxy-wi.org/howto.py/ha_cluster" title="How to create high available cluster" target="_blank">How to create high available cluster</a>
|
||||
Read <a href="https://roxy-wi.org/howto/ha-cluster" title="How to create high available cluster" target="_blank">How to create high available cluster</a>
|
||||
</div>
|
||||
<div id="server_creating" style="display: none;">
|
||||
<ul style="padding: 20px 20px 0px 20px;font-size: 15px;">
|
||||
|
|
|
@ -55,14 +55,20 @@
|
|||
});
|
||||
</script>
|
||||
<div id="up-pannel" {%if not serv%} class="sortable"{%endif%}>
|
||||
{% for s in servers %}
|
||||
{% if serv %}
|
||||
{%- for s in servers %}
|
||||
{%- if serv %}
|
||||
{% set config_id = 'id=config_link' %}
|
||||
{% set compare_id = 'id=compare_link' %}
|
||||
{% set map_id = 'id=map_link' %}
|
||||
{% set stats_id = 'id=stats_link' %}
|
||||
{% set logs_id = 'id=logs_link' %}
|
||||
{% set versions_id = 'id=versions_link' %}
|
||||
<script>
|
||||
var server_ip = '{{s.2}}'
|
||||
function showMetrics() {
|
||||
{% if service == 'haproxy' %}
|
||||
{% for s in servers %}
|
||||
{% if s.8.0.9 %}
|
||||
{%- if service == 'haproxy' %}
|
||||
{%- for s in servers %}
|
||||
{%- if s.8.0.9 %}
|
||||
getChartData(server_ip)
|
||||
getHttpChartData(server_ip)
|
||||
getWafChartData(server_ip)
|
||||
|
@ -70,16 +76,16 @@
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
showOverviewServer('{{s.1}}', server_ip, '{{s.0}}', '{{service}}');
|
||||
{% if service == 'nginx' %}
|
||||
{%- if service == 'nginx' %}
|
||||
showNginxConnections(server_ip)
|
||||
{% if s.8.0.21 %}
|
||||
getNginxChartData(server_ip)
|
||||
{% endif %}
|
||||
{% elif service == 'apache' %}
|
||||
{%- elif service == 'apache' %}
|
||||
{% if s.8.0.27 %}
|
||||
getApacheChartData(server_ip)
|
||||
{% endif %}
|
||||
{% elif service == 'haproxy' %}
|
||||
{%- elif service == 'haproxy' %}
|
||||
showBytes(server_ip)
|
||||
{% endif %}
|
||||
}
|
||||
|
@ -104,23 +110,62 @@
|
|||
metrics.then();
|
||||
});
|
||||
});
|
||||
$(document).on('keydown', null, 'a', start_button);
|
||||
function start_button(event) {
|
||||
confirmAjaxAction('start', '{{service}}', '{{s.2}}');
|
||||
}
|
||||
$(document).on('keydown', null, 's', stop_button);
|
||||
function stop_button(event) {
|
||||
confirmAjaxAction('stop', '{{service}}', '{{s.2}}');
|
||||
}
|
||||
$(document).on('keydown', null, 'e', reload_button);
|
||||
function reload_button(event) {
|
||||
confirmAjaxAction('reload', '{{service}}', '{{s.2}}');
|
||||
}
|
||||
{% for set in restart_settings %}
|
||||
{% if set.server_id == s.0 and set.setting == 'restart' and set.value|int == 0 %}
|
||||
$(document).on('keydown', null, 'r', restart_button);
|
||||
function restart_button(event) {
|
||||
confirmAjaxAction('restart', '{{service}}', '{{s.2}}', '{{s.1}}');
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
$(document).on('keydown', null, 'k', metrics_button);
|
||||
function metrics_button(event) {
|
||||
showMetrics();
|
||||
}
|
||||
$(document).bind('keydown', 'o', function (){
|
||||
window.location = document.getElementById('compare_link').href;
|
||||
});
|
||||
$(document).bind('keydown', 'c', function (){
|
||||
window.location = document.getElementById('config_link').href;
|
||||
});
|
||||
$(document).bind('keydown', 'm', function (){
|
||||
window.location = document.getElementById('map_link').href;
|
||||
});
|
||||
$(document).bind('keydown', 't', function (){
|
||||
window.location = document.getElementById('stats_link').href;
|
||||
});
|
||||
$(document).bind('keydown', 'l', function (){
|
||||
window.location = document.getElementById('logs_link').href;
|
||||
});
|
||||
$(document).bind('keydown', 'v', function (){
|
||||
window.location = document.getElementById('versions_link').href;
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% set checker_desc = "Checker monitors " +service_desc.service + " services. If " + service_desc.service + " service changes its status, Checker will alert via Telegram, Slack, Email, Web" %}
|
||||
{% if service == 'nginx' %}
|
||||
{% set checker_desc = 'Checker monitors Nginx services. If Nginx service is down, Checker will alert via Telegram and/or Slack' %}
|
||||
{% set is_auto_start_enabled = s.8.0.17 %}
|
||||
{% set is_checker_enabled = s.8.0.19 %}
|
||||
{% set is_metrics_enabled = s.8.0.21 %}
|
||||
{% set action_service = 'nginx' %}
|
||||
{% if s.5.0.1 == 'active' or s.5.0.1 == 'Up' %}
|
||||
{% set additional_status_class = 'div-server-head-up' %}
|
||||
{% else %}
|
||||
{% set additional_status_class = 'div-server-head-down' %}
|
||||
{% endif %}
|
||||
{% elif service == 'keepalived' %}
|
||||
{% set checker_desc = 'Checker monitors Keepalived services. If Keepalived service is down, Checker will alert via Telegram and/or Slack' %}
|
||||
{% set is_auto_start_enabled = s.8.0.22 %}
|
||||
{% set action_service = 'keepalived' %}
|
||||
{% set is_checker_enabled = s.8.0.23 %}
|
||||
{% if s.5.0.1 == 'active' %}
|
||||
{% set additional_status_class = 'div-server-head-up' %}
|
||||
|
@ -128,9 +173,7 @@
|
|||
{% set additional_status_class = 'div-server-head-down' %}
|
||||
{% endif %}
|
||||
{% elif service == 'apache' %}
|
||||
{% set checker_desc = 'Checker monitors Apache services. If Apache service is down, Checker will alert via Telegram and/or Slack' %}
|
||||
{% set is_auto_start_enabled = s.8.0.25 %}
|
||||
{% set action_service = 'apache' %}
|
||||
{% set is_checker_enabled = s.8.0.26 %}
|
||||
{% set is_metrics_enabled = s.8.0.27 %}
|
||||
{% if 'Apache' in s.4.0 %}
|
||||
|
@ -139,11 +182,9 @@
|
|||
{% set additional_status_class = 'div-server-head-down' %}
|
||||
{% endif %}
|
||||
{% elif service == 'haproxy' %}
|
||||
{% set checker_desc = 'Checker monitors HAProxy services, its backends and maxconn. If some backend or HAProxy service is down, Checker will alert via Telegram and/or Slack' %}
|
||||
{% set is_auto_start_enabled = s.8.0.12 %}
|
||||
{% set is_checker_enabled = s.8.0.8 %}
|
||||
{% set is_metrics_enabled = s.8.0.9 %}
|
||||
{% set action_service = 'hap' %}
|
||||
{% if s.5 != False %}
|
||||
{% set additional_status_class = 'div-server-head-up' %}
|
||||
{% else %}
|
||||
|
@ -179,27 +220,27 @@
|
|||
{% if role <= 3 %}
|
||||
<span class="server-action">
|
||||
<a id="start-{{ s.2 }}" class="start" title="Start {{service}} service">
|
||||
<span class="service-start" onclick="confirmAjaxAction('start', '{{action_service}}', '{{s.2}}')"></span>
|
||||
<span class="service-start" onclick="confirmAjaxAction('start', '{{service}}', '{{s.2}}')"></span>
|
||||
</a>
|
||||
{% if service != 'keepalived' %}
|
||||
<a id="reload-{{ s.2 }}" class="reload" title="Reload {{service}} service">
|
||||
<span class="service-reload" onclick="confirmAjaxAction('reload', '{{action_service}}', '{{s.2}}', '{{s.1}}')"></span>
|
||||
<span class="service-reload" onclick="confirmAjaxAction('reload', '{{service}}', '{{s.2}}', '{{s.1}}')"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% for set in restart_settings %}
|
||||
{% if set.server_id == s.0 and set.setting == 'restart' and set.value|int == 0 %}
|
||||
<a id="restart-{{ s.2 }}" class="restart" title="Restart {{service}} service">
|
||||
<span class="service-reload service-restart" onclick="confirmAjaxAction('restart', '{{action_service}}', '{{s.2}}')"></span>
|
||||
<span class="service-reload service-restart" onclick="confirmAjaxAction('restart', '{{service}}', '{{s.2}}')"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if restart_settings|length == 0 %}
|
||||
<a id="restart-{{ s.2 }}" class="restart" title="Restart {{service}} service">
|
||||
<span class="service-reload service-restart" onclick="confirmAjaxAction('restart', '{{action_service}}', '{{s.2}}')"></span>
|
||||
<span class="service-reload service-restart" onclick="confirmAjaxAction('restart', '{{service}}', '{{s.2}}')"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a id="stop-{{ s.2 }}" class="stop" title="Stop {{service}} service">
|
||||
<span class="service-stop" onclick="confirmAjaxAction('stop', '{{action_service}}', '{{s.2}}')"></span>
|
||||
<span class="service-stop" onclick="confirmAjaxAction('stop', '{{service}}', '{{s.2}}')"></span>
|
||||
</a>
|
||||
<a href="history.py?service={{service}}&serv={{s.2}}" title="View history for this service" class="history" style="margin: 0 5px 0 10px;"></a>
|
||||
{% if service != 'keepalived' %}
|
||||
|
@ -288,20 +329,20 @@
|
|||
</div>
|
||||
<div class="server-act-links">
|
||||
{% if service == 'nginx' or service == 'apache' %}
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showConfigFiles" class="ui-button ui-widget ui-corner-all" title="Open running configs">Configs</a>
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showConfigFiles" {{config_id}} class="ui-button ui-widget ui-corner-all" title="Open running configs">Configs</a>
|
||||
{% else %}
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showConfig" class="ui-button ui-widget ui-corner-all" title="Open running config">Config</a>
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showConfig" {{config_id}} class="ui-button ui-widget ui-corner-all" title="Open running config">Config</a>
|
||||
{% endif %}
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showCompare" class="ui-button ui-widget ui-corner-all" title="Compare configs">Compare</a>
|
||||
{% if service != 'nginx' and service != 'keepalived' and service != 'apache' %}
|
||||
<a href="/app/config.py?serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" title="Show map">Map</a>
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showCompare" {{compare_id}} class="ui-button ui-widget ui-corner-all" title="Compare configs">Compare</a>
|
||||
{% if service == 'haproxy' %}
|
||||
<a href="/app/config.py?service={{service}}&serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" {{map_id}} title="Show map">Map</a>
|
||||
{% endif %}
|
||||
{% if service != 'keepalived' %}
|
||||
<a href="/app/statsview.py?service={{service}}&serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View {{service}} statistics">Stats</a>
|
||||
<a href="/app/statsview.py?service={{service}}&serv={{s.2}}" class="ui-button ui-widget ui-corner-all" {{stats_id}} title="View {{service}} statistics">Stats</a>
|
||||
{% endif %}
|
||||
<a href="/app/logs.py?service={{service}}&serv={{s.2}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" class="ui-button ui-widget ui-corner-all" title="View {{service}} logs">Logs</a>
|
||||
<a href="/app/logs.py?service={{service}}&serv={{s.2}}&rows=10&grep=&hour=00&minut=00&hour1=24&minut1=00" {{logs_id}} class="ui-button ui-widget ui-corner-all" title="View {{service}} logs">Logs</a>
|
||||
{% if role <= 2 %}
|
||||
<a href="/app/versions.py?service={{service}}&serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all" title="View/Rollback to previous config">Versions</a>
|
||||
<a href="/app/versions.py?service={{service}}&serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all" {{versions_id}} title="View/Rollback to previous config">Versions</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -54,12 +54,9 @@ try:
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
user, user_id, role, token, servers, user_services = funct.get_users_params()
|
||||
except Exception:
|
||||
pass
|
||||
user, user_id, role, token, servers, user_services = funct.get_users_params()
|
||||
|
||||
selects = funct.get_files(log_path, format="log")
|
||||
selects = funct.get_files(log_path, "log")
|
||||
if form.getvalue('type') is None:
|
||||
selects.append(['fail2ban.log', 'fail2ban.log'])
|
||||
selects.append(['roxy-wi.error.log', 'error.log'])
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||
RewriteRule /(.*) ws://localhost:8765/ [P,L]
|
||||
ProxyPassReverse / http://localhost:8765/
|
||||
|
||||
WSGIDaemonProcess api display-name=%{GROUP} user=apache group=apache processes=1 threads=5
|
||||
WSGIScriptAlias /api /var/www/haproxy-wi/api/app.wsgi
|
||||
|
||||
|
@ -37,12 +38,6 @@
|
|||
Deny from all
|
||||
</Directory>
|
||||
|
||||
<Directory /var/www/haproxy-wi/keys>
|
||||
Options +ExecCGI -Indexes +MultiViews
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</Directory>
|
||||
|
||||
<Directory /var/www/haproxy-wi/app/scripts/terraform/>
|
||||
Deny from all
|
||||
</Directory>
|
||||
|
@ -51,16 +46,6 @@
|
|||
Deny from all
|
||||
</Directory>
|
||||
|
||||
<FilesMatch "\.cfg$">
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.db$">
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
Header set X-XSS-Protection: 1;
|
||||
Header set X-Frame-Options: deny
|
||||
|
|
|
@ -38,12 +38,6 @@
|
|||
Deny from all
|
||||
</Directory>
|
||||
|
||||
<Directory /var/www/haproxy-wi/keys>
|
||||
Options +ExecCGI -Indexes +MultiViews
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</Directory>
|
||||
|
||||
<Directory /var/www/haproxy-wi/app/scripts/terraform/>
|
||||
Deny from all
|
||||
</Directory>
|
||||
|
@ -52,16 +46,6 @@
|
|||
Deny from all
|
||||
</Directory>
|
||||
|
||||
<FilesMatch "\.cfg$">
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.db$">
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
Header set X-XSS-Protection: 1;
|
||||
Header set X-Frame-Options: deny
|
||||
|
|
24
inc/add.js
24
inc/add.js
|
@ -1491,7 +1491,7 @@ function view_ssl(id) {
|
|||
} );
|
||||
}
|
||||
function deleteSsl(id) {
|
||||
if(!checkIsServerFiled('#serv5')) return false;;
|
||||
if(!checkIsServerFiled('#serv5')) return false;
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
|
@ -1629,9 +1629,7 @@ function editList(list, color) {
|
|||
}
|
||||
function saveList(action, list, color) {
|
||||
var serv = $( "#serv-"+color+"-list option:selected" ).val();
|
||||
if (serv == '------') {
|
||||
toastr.warning('Select a server before updating');
|
||||
} else {
|
||||
if(!checkIsServerFiled(serv)) return false;
|
||||
$.ajax({
|
||||
url: "options.py",
|
||||
data: {
|
||||
|
@ -1646,7 +1644,6 @@ function saveList(action, list, color) {
|
|||
type: "POST",
|
||||
success: function (data) {
|
||||
data = data.split(" , ");
|
||||
|
||||
for (i = 0; i < data.length; i++) {
|
||||
if (data[i]) {
|
||||
if (data[i].indexOf('error: ') != '-1' || data[i].indexOf('Errno') != '-1') {
|
||||
|
@ -1658,13 +1655,10 @@ function saveList(action, list, color) {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function deleteList(list, color) {
|
||||
var serv = $( "#serv-"+color+"-list option:selected" ).val();
|
||||
if (serv == '------') {
|
||||
toastr.warning('Choose a server before deleting');
|
||||
} else {
|
||||
if(!checkIsServerFiled(serv)) return false;
|
||||
$.ajax({
|
||||
url: "options.py",
|
||||
data: {
|
||||
|
@ -1684,13 +1678,10 @@ function deleteList(list, color) {
|
|||
} else if (data.indexOf('success') != '-1' ) {
|
||||
toastr.clear();
|
||||
toastr.success('List has been deleted');
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 2500);
|
||||
setTimeout(function () {location.reload();}, 2500);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function generateConfig(form_name) {
|
||||
var frm = $('#'+form_name);
|
||||
|
@ -1901,7 +1892,7 @@ var acl_option = '<p id="new_acl_p" style="border-bottom: 1px solid #ddd; paddin
|
|||
'\t<option value="7">Set-header</option>\n' +
|
||||
'</select>\n' +
|
||||
'<b class="padding10">value</b>\n' +
|
||||
'<input type="text" name="acl_then_value" class="form-control" value="" title="Required if \"then\" is \"Use backend\" or \"Redirect\"">\n' +
|
||||
'<input type="text" name="acl_then_value" class="form-control" value="" title="Required if\" then\" is \"Use backend\" or \"Redirect\"">\n' +
|
||||
'<span class="minus minus-style" id="new_acl_rule_minus" title="Delete this ACL"></span>' +
|
||||
'</p>'
|
||||
function make_actions_for_adding_acl_rule(section_id) {
|
||||
|
@ -1969,9 +1960,7 @@ function makeid(length) {
|
|||
}
|
||||
function showUserlists() {
|
||||
var serv = $( "#existing_userlist_serv option:selected" ).val();
|
||||
if (serv == 'Choose server') {
|
||||
toastr.warning('Choose a server before');
|
||||
} else {
|
||||
if(!checkIsServerFiled(serv)) return false;
|
||||
$.ajax({
|
||||
url: "options.py",
|
||||
data: {
|
||||
|
@ -1996,7 +1985,6 @@ function showUserlists() {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function changePortCheckFromServerPort() {
|
||||
$('[name=server_port]').on('input', function (){
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
/*jslint browser: true*/
|
||||
/*jslint jquery: true*/
|
||||
|
||||
/*
|
||||
* jQuery Hotkeys Plugin
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Based upon the plugin by Tzury Bar Yochay:
|
||||
* https://github.com/tzuryby/jquery.hotkeys
|
||||
*
|
||||
* Original idea by:
|
||||
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
||||
*/
|
||||
|
||||
/*
|
||||
* One small change is: now keys are passed by object { keys: '...' }
|
||||
* Might be useful, when you want to pass some other data to your handler
|
||||
*/
|
||||
|
||||
(function(jQuery) {
|
||||
|
||||
jQuery.hotkeys = {
|
||||
version: "0.2.0",
|
||||
|
||||
specialKeys: {
|
||||
8: "backspace",
|
||||
9: "tab",
|
||||
10: "return",
|
||||
13: "return",
|
||||
16: "shift",
|
||||
17: "ctrl",
|
||||
18: "alt",
|
||||
19: "pause",
|
||||
20: "capslock",
|
||||
27: "esc",
|
||||
32: "space",
|
||||
33: "pageup",
|
||||
34: "pagedown",
|
||||
35: "end",
|
||||
36: "home",
|
||||
37: "left",
|
||||
38: "up",
|
||||
39: "right",
|
||||
40: "down",
|
||||
45: "insert",
|
||||
46: "del",
|
||||
59: ";",
|
||||
61: "=",
|
||||
96: "0",
|
||||
97: "1",
|
||||
98: "2",
|
||||
99: "3",
|
||||
100: "4",
|
||||
101: "5",
|
||||
102: "6",
|
||||
103: "7",
|
||||
104: "8",
|
||||
105: "9",
|
||||
106: "*",
|
||||
107: "+",
|
||||
109: "-",
|
||||
110: ".",
|
||||
111: "/",
|
||||
112: "f1",
|
||||
113: "f2",
|
||||
114: "f3",
|
||||
115: "f4",
|
||||
116: "f5",
|
||||
117: "f6",
|
||||
118: "f7",
|
||||
119: "f8",
|
||||
120: "f9",
|
||||
121: "f10",
|
||||
122: "f11",
|
||||
123: "f12",
|
||||
144: "numlock",
|
||||
145: "scroll",
|
||||
173: "-",
|
||||
186: ";",
|
||||
187: "=",
|
||||
188: ",",
|
||||
189: "-",
|
||||
190: ".",
|
||||
191: "/",
|
||||
192: "`",
|
||||
219: "[",
|
||||
220: "\\",
|
||||
221: "]",
|
||||
222: "'"
|
||||
},
|
||||
|
||||
shiftNums: {
|
||||
"`": "~",
|
||||
"1": "!",
|
||||
"2": "@",
|
||||
"3": "#",
|
||||
"4": "$",
|
||||
"5": "%",
|
||||
"6": "^",
|
||||
"7": "&",
|
||||
"8": "*",
|
||||
"9": "(",
|
||||
"0": ")",
|
||||
"-": "_",
|
||||
"=": "+",
|
||||
";": ": ",
|
||||
"'": "\"",
|
||||
",": "<",
|
||||
".": ">",
|
||||
"/": "?",
|
||||
"\\": "|"
|
||||
},
|
||||
|
||||
// excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url
|
||||
textAcceptingInputTypes: [
|
||||
"text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime",
|
||||
"datetime-local", "search", "color", "tel"],
|
||||
|
||||
// default input types not to bind to unless bound directly
|
||||
textInputTypes: /textarea|input|select/i,
|
||||
|
||||
options: {
|
||||
filterInputAcceptingElements: true,
|
||||
filterTextInputs: true,
|
||||
filterContentEditable: true
|
||||
}
|
||||
};
|
||||
|
||||
function keyHandler(handleObj) {
|
||||
if (typeof handleObj.data === "string") {
|
||||
handleObj.data = {
|
||||
keys: handleObj.data
|
||||
};
|
||||
}
|
||||
|
||||
// Only care when a possible input has been specified
|
||||
if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") {
|
||||
return;
|
||||
}
|
||||
|
||||
var origHandler = handleObj.handler,
|
||||
keys = handleObj.data.keys.toLowerCase().split(" ");
|
||||
|
||||
handleObj.handler = function(event) {
|
||||
// Don't fire in text-accepting inputs that we didn't directly bind to
|
||||
if (this !== event.target &&
|
||||
(jQuery.hotkeys.options.filterInputAcceptingElements &&
|
||||
jQuery.hotkeys.textInputTypes.test(event.target.nodeName) ||
|
||||
(jQuery.hotkeys.options.filterContentEditable && jQuery(event.target).attr('contenteditable')) ||
|
||||
(jQuery.hotkeys.options.filterTextInputs &&
|
||||
jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {
|
||||
return;
|
||||
}
|
||||
|
||||
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
|
||||
character = String.fromCharCode(event.which).toLowerCase(),
|
||||
modif = "",
|
||||
possible = {};
|
||||
|
||||
jQuery.each(["alt", "ctrl", "shift"], function(index, specialKey) {
|
||||
|
||||
if (event[specialKey + 'Key'] && special !== specialKey) {
|
||||
modif += specialKey + '+';
|
||||
}
|
||||
});
|
||||
|
||||
// metaKey is triggered off ctrlKey erronously
|
||||
if (event.metaKey && !event.ctrlKey && special !== "meta") {
|
||||
modif += "meta+";
|
||||
}
|
||||
|
||||
if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) {
|
||||
modif = modif.replace("alt+ctrl+shift+", "hyper+");
|
||||
}
|
||||
|
||||
if (special) {
|
||||
possible[modif + special] = true;
|
||||
}
|
||||
else {
|
||||
possible[modif + character] = true;
|
||||
possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
|
||||
|
||||
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
||||
if (modif === "shift+") {
|
||||
possible[jQuery.hotkeys.shiftNums[character]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0, l = keys.length; i < l; i++) {
|
||||
if (possible[keys[i]]) {
|
||||
return origHandler.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
jQuery.each(["keydown", "keyup", "keypress"], function() {
|
||||
jQuery.event.special[this] = {
|
||||
add: keyHandler
|
||||
};
|
||||
});
|
||||
|
||||
})(jQuery || this.jQuery || window.jQuery);
|
|
@ -322,10 +322,15 @@ function getApacheChartData(server) {
|
|||
});
|
||||
}
|
||||
function loadMetrics() {
|
||||
var service = findGetParameter('service');
|
||||
if (!service) {
|
||||
service = 'haproxy';
|
||||
}
|
||||
$.ajax({
|
||||
url: "options.py",
|
||||
data: {
|
||||
table_metrics: '1',
|
||||
service: service,
|
||||
token: $('#token').val()
|
||||
},
|
||||
beforeSend: function() {
|
||||
|
|
|
@ -395,7 +395,7 @@ function confirmAjaxAction(action, service, id) {
|
|||
buttons: {
|
||||
"Sure": function() {
|
||||
$( this ).dialog( "close" );
|
||||
if(service == "hap") {
|
||||
if(service == "haproxy") {
|
||||
ajaxActionServers(action, id);
|
||||
if(action == "restart" || action == "reload") {
|
||||
if(localStorage.getItem('restart')) {
|
||||
|
|
|
@ -466,7 +466,7 @@ function showMap() {
|
|||
} else {
|
||||
toastr.clear();
|
||||
$("#ajax").html(data);
|
||||
window.history.pushState("Show map", "Show map", cur_url[0] + '?serv=' + $("#serv").val() + '&showMap');
|
||||
window.history.pushState("Show map", "Show map", cur_url[0] + '?service=haproxy&serv=' + $("#serv").val() + '&showMap');
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -724,34 +724,6 @@ function viewLogs() {
|
|||
}
|
||||
}
|
||||
$( function() {
|
||||
NProgress.configure({showSpinner: false});
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
show_versions: 1,
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "POST",
|
||||
success: function( data ) {
|
||||
$('#version').html(data);
|
||||
var showUpdates = $( "#show-updates" ).dialog({
|
||||
autoOpen: false,
|
||||
width: 600,
|
||||
modal: true,
|
||||
title: 'There is a new version Roxy-WI',
|
||||
buttons: {
|
||||
Close: function() {
|
||||
$( this ).dialog( "close" );
|
||||
clearTips();
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#show-updates-button').click(function() {
|
||||
showUpdates.dialog('open');
|
||||
});
|
||||
}
|
||||
} );
|
||||
NProgress.configure({showSpinner: true});
|
||||
$('a').click(function(e) {
|
||||
try {
|
||||
var cur_path = window.location.pathname;
|
||||
|
@ -1535,3 +1507,33 @@ function returnNiceCheckingConfig(data) {
|
|||
toastr.success('<b>' + server_name2 + ' Configuration file is valid</b>');
|
||||
}
|
||||
}
|
||||
function show_version() {
|
||||
NProgress.configure({showSpinner: false});
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
show_versions: 1,
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "POST",
|
||||
success: function( data ) {
|
||||
$('#version').html(data);
|
||||
var showUpdates = $( "#show-updates" ).dialog({
|
||||
autoOpen: false,
|
||||
width: 600,
|
||||
modal: true,
|
||||
title: 'There is a new Roxy-WI version',
|
||||
buttons: {
|
||||
Close: function() {
|
||||
$( this ).dialog( "close" );
|
||||
clearTips();
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#show-updates-button').click(function() {
|
||||
showUpdates.dialog('open');
|
||||
});
|
||||
}
|
||||
} );
|
||||
NProgress.configure({showSpinner: true});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue