Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

fixed: [tT]reshold -> [tT]hreshold typo #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/views/_checkDetails.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<label class="control-label">Alert threshold</label>
<div class="controls">
<div class="input-append">
<input type="text" name="check[alertTreshold]" value="<%= check.alertTreshold %>" class="span1" />
<input type="text" name="check[alertThreshold]" value="<%= check.alertThreshold %>" class="span1" />
<span class="add-on">failed pings</span>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions models/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down