Alerting cleanup

This commit is contained in:
Akkadius 2017-09-06 03:57:00 -05:00
parent f43616c86b
commit 88cba6d48a

14
app.js
View File

@ -371,11 +371,11 @@ alert_check_timer = setInterval(function(){
console.log("[Timer] lpm: %s lpm_th: %s", leases_per_minute, glass_config.leases_per_minute_threshold);
if (leases_per_minute <= glass_config.leases_per_minute_threshold && alert_status['leases_per_minute'] == 0) {
alert_status['leases_per_minute'] = 1;
slack_message(":warning: WARNING: DHCP leases per minute have dropped below critical threshold (" + glass_config.leases_per_minute_threshold.toLocaleString('en') + ") Current LP/s (" + leases_per_minute.toLocaleString('en') + ")");
slack_message(":warning: WARNING: DHCP leases per minute have dropped below critical threshold (" + parseInt(glass_config.leases_per_minute_threshold).toLocaleString('en') + ") Current (" + parseInt(leases_per_minute).toLocaleString('en') + ")");
}
else if (leases_per_minute >= glass_config.leases_per_minute_threshold && alert_status['leases_per_minute'] == 1) {
alert_status['leases_per_minute'] = 0;
slack_message(":white_check_mark: CLEAR: DHCP leases per minute have returned to above the critical threshold (" + glass_config.leases_per_minute_threshold.toLocaleString('en') + ") Current LP/s (" + leases_per_minute.toLocaleString('en') + ")");
slack_message(":white_check_mark: CLEAR: DHCP leases per minute have returned to above the critical threshold (" + parseInt(glass_config.leases_per_minute_threshold).toLocaleString('en') + ") Current (" + parseInt(leases_per_minute).toLocaleString('en') + ")");
}
}
}, (60 * 1000));
@ -408,12 +408,14 @@ alert_subnet_check_timer = setInterval(function(){
if(typeof alert_status_networks_critical[dhcp_data['shared-networks'][i].location] === "undefined")
alert_status_networks_critical[dhcp_data['shared-networks'][i].location] = 0;
/*
console.log("Location: %s", dhcp_data['shared-networks'][i].location);
console.log("Used: %s", dhcp_data['shared-networks'][i].used.toLocaleString('en'));
console.log("Defined: %s", dhcp_data['shared-networks'][i].defined.toLocaleString('en'));
console.log("Free: %s", dhcp_data['shared-networks'][i].free.toLocaleString('en'));
console.log("Utilization: %s", utilization);
console.log(" \n");
*/
/* Check Warnings */
if(glass_config.shared_network_warning_threshold > 0) {
@ -424,7 +426,7 @@ alert_subnet_check_timer = setInterval(function(){
)
{
alert_status_networks_warning[dhcp_data['shared-networks'][i].location] = 1;
slack_message(":warning: WARNING: DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + ") Threshold: (" + glass_config.shared_network_warning_threshold + ")");
slack_message(":warning: WARNING: DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + "%) Threshold: (" + glass_config.shared_network_warning_threshold + "%)");
}
else if (
utilization <= glass_config.shared_network_warning_threshold &&
@ -432,7 +434,7 @@ alert_subnet_check_timer = setInterval(function(){
)
{
alert_status_networks_warning[dhcp_data['shared-networks'][i].location] = 0;
slack_message(":white_check_mark: CLEAR: Warning DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + ") Threshold: (" + glass_config.shared_network_warning_threshold + ")");
slack_message(":white_check_mark: CLEAR: Warning DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + "%) Threshold: (" + glass_config.shared_network_warning_threshold + "%)");
}
}
@ -444,7 +446,7 @@ alert_subnet_check_timer = setInterval(function(){
)
{
alert_status_networks_critical[dhcp_data['shared-networks'][i].location] = 1;
slack_message(":fire: CRITICAL: DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + ") Threshold: (" + glass_config.shared_network_critical_threshold + ")");
slack_message(":fire: CRITICAL: DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + "%) Threshold: (" + glass_config.shared_network_critical_threshold + "%)");
}
else if (
utilization <= glass_config.shared_network_critical_threshold &&
@ -452,7 +454,7 @@ alert_subnet_check_timer = setInterval(function(){
)
{
alert_status_networks_critical[dhcp_data['shared-networks'][i].location] = 0;
slack_message(":white_check_mark: CLEAR: Critical DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + ") Threshold: (" + glass_config.shared_network_critical_threshold + ")");
slack_message(":white_check_mark: CLEAR: Critical DHCP shared network utilization (" + dhcp_data['shared-networks'][i].location + ") Current: (" + utilization + "%) Threshold: (" + glass_config.shared_network_critical_threshold + "%)");
}
}
}