mirror of https://github.com/Aidaho12/haproxy-wi
parent
20c99b06d1
commit
f8e43ddc1a
38
app/smon.py
38
app/smon.py
|
@ -22,27 +22,35 @@ except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if action == 'add':
|
if action == 'add':
|
||||||
smon = sql.select_smon(user_group,action='add')
|
smon = sql.select_smon(user_group, action='add')
|
||||||
funct.page_for_admin(level=3)
|
funct.page_for_admin(level=3)
|
||||||
title = "SMON Admin"
|
title = "SMON Admin"
|
||||||
autorefresh = 0
|
autorefresh = 0
|
||||||
|
elif action == 'history':
|
||||||
|
smon = sql.alerts_history('SMON', user_group)
|
||||||
|
title = "SMON History"
|
||||||
|
autorefresh = 0
|
||||||
|
elif action == 'checker_history':
|
||||||
|
smon = sql.alerts_history('Checker', user_group)
|
||||||
|
title = "Checker History"
|
||||||
|
autorefresh = 0
|
||||||
else:
|
else:
|
||||||
smon = sql.smon_list(user_group)
|
smon = sql.smon_list(user_group)
|
||||||
title = "SMON Dashboard"
|
title = "SMON Dashboard"
|
||||||
autorefresh = 1
|
autorefresh = 1
|
||||||
|
|
||||||
|
|
||||||
template = template.render(h2 = 1, title = title,
|
template = template.render(h2=1, title=title,
|
||||||
autorefresh = autorefresh,
|
autorefresh=autorefresh,
|
||||||
role = role,
|
role=role,
|
||||||
user = user,
|
user=user,
|
||||||
group = user_group,
|
group=user_group,
|
||||||
telegrams = sql.get_user_telegram_by_group(user_group),
|
telegrams=sql.get_user_telegram_by_group(user_group),
|
||||||
versions = funct.versions(),
|
versions=funct.versions(),
|
||||||
smon = smon,
|
smon=smon,
|
||||||
smon_status = smon_status,
|
smon_status=smon_status,
|
||||||
smon_error = stderr,
|
smon_error=stderr,
|
||||||
action = action,
|
action=action,
|
||||||
sort = sort,
|
sort=sort,
|
||||||
token = token)
|
token=token)
|
||||||
print(template)
|
print(template)
|
||||||
|
|
44
inc/users.js
44
inc/users.js
|
@ -1943,25 +1943,25 @@ function updateService(service) {
|
||||||
toastr.success('Update was success!');
|
toastr.success('Update was success!');
|
||||||
} else if (data.indexOf('Unauthorized') != '-1') {
|
} else if (data.indexOf('Unauthorized') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error('It is seems like you Unauthorized in the HAProxy-WI repository. How to get HAProxy-WI auth you can read <a href="https://haproxy-wi.org/installation.py" title="How to get HAProxy-WI auth">hear</a>');
|
toastr.error('It seems like Unauthorized in the HAProxy-WI repository. How to get HAProxy-WI auth you can read <a href="https://haproxy-wi.org/installation.py" title="How to get HAProxy-WI auth">hear</a>');
|
||||||
} else if (data.indexOf('but not installed') != '-1') {
|
} else if (data.indexOf('but not installed') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error('You have settings for HAProxy-WI repository, but installed HAProxy-WI without repository. Please reinstall with yum');
|
toastr.error('There is settings for HAProxy-WI repository, but HAProxy-WI is installed without repository. Please reinstall with yum');
|
||||||
} else if (data.indexOf('No Match for argument') != '-1') {
|
} else if (data.indexOf('No Match for argument') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error('It is seems like you do not have HAProxy-WI repository settings. Please read docs for <a href="https://haproxy-wi.org/updates.py">detail</a>');
|
toastr.error('It seems like HAProxy-WI repository is not set. Please read docs for <a href="https://haproxy-wi.org/updates.py">detail</a>');
|
||||||
} else if (data.indexOf('password for') != '-1') {
|
} else if (data.indexOf('password for') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error('It is seems like you need add Apache user to sudoers. Please read docs for<a href="https://haproxy-wi.org/updates.py">detail</a>');
|
toastr.error('It seems like apache user needs to be add to sudoers. Please read docs for<a href="https://haproxy-wi.org/updates.py">detail</a>');
|
||||||
} else if (data.indexOf('No packages marked for update') != '-1') {
|
} else if (data.indexOf('No packages marked for update') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.info('It is seems like you have the lastest version HAProxy-WI');
|
toastr.info('It seems like the lastest version HAProxy-WI is installed');
|
||||||
} else if (data.indexOf('Connection timed out') != '-1') {
|
} else if (data.indexOf('Connection timed out') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error('Cannot connect to HAProxy-WI repository. Connection timed out');
|
toastr.error('Cannot connect to HAProxy-WI repository. Connection timed out');
|
||||||
} else if (data.indexOf('--disable') != '-1') {
|
} else if (data.indexOf('--disable') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error('It is seems like you have problem with your repositories');
|
toastr.error('It seems like there is a problem with repositories');
|
||||||
} else if (data.indexOf('Error: Package') != '-1') {
|
} else if (data.indexOf('Error: Package') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error(data);
|
toastr.error(data);
|
||||||
|
@ -2094,3 +2094,35 @@ function scanPorts(id) {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
function viewFirewallRules(id) {
|
||||||
|
$.ajax({
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
viewFirewallRules: id,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('danger') != '-1' || data.indexOf('unique') != '-1' || data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#firewall_rules_body").html(data);
|
||||||
|
$("#firewall_rules" ).dialog({
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 860,
|
||||||
|
modal: true,
|
||||||
|
title: "Firewall rules",
|
||||||
|
buttons: {
|
||||||
|
Close: function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
$("#firewall_rules_body").html('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue