mirror of https://github.com/Aidaho12/haproxy-wi
parent
6b9f93f1de
commit
1ca8aa3674
|
@ -1,13 +1,14 @@
|
|||
[main]
|
||||
# Path to the files destination
|
||||
fullpath = /var/www/haproxy-wi
|
||||
log_path = ${fullpath}/log/
|
||||
log_path = ${fullpath}/log/
|
||||
|
||||
[configs]
|
||||
# Folders for configs
|
||||
haproxy_save_configs_dir = ${main:fullpath}/configs/hap_config/
|
||||
kp_save_configs_dir = ${main:fullpath}/configs/kp_config/
|
||||
nginx_save_configs_dir = ${main:fullpath}/configs/nginx_config/
|
||||
apache_save_configs_dir = ${main:fullpath}/configs/apache_config/
|
||||
|
||||
[mysql]
|
||||
# By default Sqlite DB is used
|
||||
|
|
19
app/sql.py
19
app/sql.py
|
@ -278,6 +278,9 @@ def update_hapwi_server(server_id, alert, metrics, active, service_name):
|
|||
elif service_name == 'keepalived':
|
||||
update_hapwi = Server.update(keepalived_alert=alert, keepalived_active=active).where(
|
||||
Server.server_id == server_id)
|
||||
elif service_name == 'apache':
|
||||
update_hapwi = Server.update(apache_alert=alert).where(
|
||||
Server.server_id == server_id)
|
||||
else:
|
||||
update_hapwi = Server.update(alert=alert, metrics=metrics, active=active).where(
|
||||
Server.server_id == server_id)
|
||||
|
@ -1888,6 +1891,22 @@ def select_nginx_alert(**kwargs):
|
|||
return query_res
|
||||
|
||||
|
||||
def select_apache_alert(**kwargs):
|
||||
if kwargs.get("group") is not None:
|
||||
query = Server.select(Server.ip).where(
|
||||
(Server.apache_alert == 1) &
|
||||
(Server.enable == 1) &
|
||||
(Server.groups == kwargs.get('group')))
|
||||
else:
|
||||
query = Server.select(Server.ip).where((Server.apache_alert == 1) & (Server.enable == 1))
|
||||
try:
|
||||
query_res = query.execute()
|
||||
except Exception as e:
|
||||
out_error(e)
|
||||
else:
|
||||
return query_res
|
||||
|
||||
|
||||
def select_keepalived_alert(**kwargs):
|
||||
if kwargs.get("group") is not None:
|
||||
query = Server.select(Server.ip).where(
|
||||
|
|
Loading…
Reference in New Issue