From b8f878af034b8a40e88001a0967879e1a8e7ef04 Mon Sep 17 00:00:00 2001 From: curtisz Date: Thu, 22 Jan 2015 14:07:00 -0800 Subject: [PATCH] fixed: [tT]reshold -> [tT]hreshold typo --- README.md | 4 ++-- app/dashboard/views/_checkDetails.ejs | 2 +- models/check.js | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b1c9cfa48..ebd20424a 100644 --- a/README.md +++ b/README.md @@ -319,7 +319,7 @@ Parameters : * `interval` : (optional) Interval of polling * `maxTime` : (optional) Slow threshold * `isPaused` : (optional) Status of polling -* `alertTreshold` : (optional) set the threshold of failed pings that will create an alert +* `alertThreshold` : (optional) set the threshold of failed pings that will create an alert * `tags` : (optional) list of tags (comma-separated values) * `type` : (optional) type of check (auto|http|https|udp) @@ -335,7 +335,7 @@ Parameters : * `interval` : (optional) Interval of polling * `maxTime` : (optional) Slow threshold * `isPaused` : (optional) Status of polling -* `alertTreshold` : (optional) set the threshold of failed pings that will create an alert +* `alertThreshold` : (optional) set the threshold of failed pings that will create an alert * `tags` : (optional) list of tags (comma-separated values) * `type` : (optional) type of check - values : `auto`|`http`|`https`|`udp` diff --git a/app/dashboard/views/_checkDetails.ejs b/app/dashboard/views/_checkDetails.ejs index 8f5a59f7a..90fb75eac 100644 --- a/app/dashboard/views/_checkDetails.ejs +++ b/app/dashboard/views/_checkDetails.ejs @@ -85,7 +85,7 @@
- + failed pings
diff --git a/models/check.js b/models/check.js index f44444a2f..5e003c8a5 100644 --- a/models/check.js +++ b/models/check.js @@ -19,7 +19,7 @@ var Check = new Schema({ url : String, interval : { type: Number, default: 60000 }, // interval between two pings maxTime : { type: Number, default: 1500 }, // time under which a ping is considered responsive - alertTreshold : { type: Number, default: 1 }, // nb of errors from which to trigger a new CheckEvent + alertThreshold : { type: Number, default: 1 }, // nb of errors from which to trigger a new CheckEvent errorCount : { type: Number, default: 0 }, // count number of errors tags : [String], lastChanged : Date, @@ -136,30 +136,30 @@ Check.methods.mustNotifyEvent = function(status) { // check goes down for the first time this.errorCount = 1; } - if (this.errorCount < this.alertTreshold) { - // repeated down pings - increase error count until reaching the down alert treshold + if (this.errorCount < this.alertThreshold) { + // repeated down pings - increase error count until reaching the down alert threshold this.errorCount++; return false; } - if (this.errorCount === this.alertTreshold) { + if (this.errorCount === this.alertThreshold) { // enough down pings to trigger notification return true; } - // error count higher than treshold, that means the alert was already sent + // error count higher than threshold, that means the alert was already sent return false; } // check is up - if (this.isUp != status && this.errorCount > this.alertTreshold) { - // check goes up after reaching the down alert treshold before + if (this.isUp != status && this.errorCount > this.alertThreshold) { + // check goes up after reaching the down alert threshold before return true; } - // check either goes up after less than alertTreshold down pings, or is already up for long + // check either goes up after less than alertThreshold down pings, or is already up for long return false; }; Check.methods.markEventNotified = function() { // increase error count to disable notification if the next ping has the same status - this.errorCount = this.alertTreshold + 1; + this.errorCount = this.alertThreshold + 1; }; Check.methods.getQosPercentage = function() { @@ -318,7 +318,7 @@ Check.methods.populateFromDirtyCheck = function(dirtyCheck, pollerCollection) { this.url = dirtyCheck.url || this.url; this.maxTime = dirtyCheck.maxTime || this.maxTime; this.isPaused = dirtyCheck.isPaused || this.isPaused; - this.alertTreshold = dirtyCheck.alertTreshold || this.alertTreshold; + this.alertThreshold = dirtyCheck.alertThreshold || this.alertThreshold; this.interval = dirtyCheck.interval * 1000 || this.interval; if (typeof(dirtyCheck.name) !== 'undefined' && dirtyCheck.name.length) {