Don't start alerting checks until after a minute

This commit is contained in:
Akkadius 2017-09-14 04:33:36 -05:00
parent 5fd98d6ad0
commit 359c571d24
1 changed files with 84 additions and 83 deletions

15
app.js
View File

@ -370,8 +370,8 @@ function slack_message(message) {
alert_status = []; alert_status = [];
alert_status['leases_per_minute'] = 0; alert_status['leases_per_minute'] = 0;
setTimeout(function(){
alert_check_timer = setInterval(function(){ alert_check_timer = setInterval(function(){
console.log("[Timer] Alert Timer check"); console.log("[Timer] Alert Timer check");
if(glass_config.leases_per_minute_threshold > 0) { if(glass_config.leases_per_minute_threshold > 0) {
console.log("[Timer] lpm: %s lpm_th: %s", leases_per_minute, glass_config.leases_per_minute_threshold); console.log("[Timer] lpm: %s lpm_th: %s", leases_per_minute, glass_config.leases_per_minute_threshold);
@ -384,12 +384,12 @@ alert_check_timer = setInterval(function(){
slack_message(":white_check_mark: CLEAR: DHCP leases per minute have returned to above threshold (" + parseInt(glass_config.leases_per_minute_threshold).toLocaleString('en') + ") Current (" + parseInt(leases_per_minute).toLocaleString('en') + ")"); slack_message(":white_check_mark: CLEAR: DHCP leases per minute have returned to above threshold (" + parseInt(glass_config.leases_per_minute_threshold).toLocaleString('en') + ") Current (" + parseInt(leases_per_minute).toLocaleString('en') + ")");
} }
} }
}, (60 * 1000)); }, (60 * 1000));
alert_status_networks_warning = []; alert_status_networks_warning = [];
alert_status_networks_critical = []; alert_status_networks_critical = [];
alert_subnet_check_timer = setInterval(function(){ alert_subnet_check_timer = setInterval(function(){
console.log("[Timer] Alert Timer check - subnets"); console.log("[Timer] Alert Timer check - subnets");
if(glass_config.shared_network_warning_threshold > 0 || glass_config.shared_network_critical_threshold > 0) { if(glass_config.shared_network_warning_threshold > 0 || glass_config.shared_network_critical_threshold > 0) {
@ -465,7 +465,8 @@ alert_subnet_check_timer = setInterval(function(){
} }
} }
} }
}, (5 * 1000)); }, (5 * 1000));
}, 60 * 1000);
function round(num, places) { function round(num, places) {
var multiplier = Math.pow(10, places); var multiplier = Math.pow(10, places);