Skip to content
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: 4 additions & 0 deletions hooks/alertops/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AlertOps

Sends a error event to AlertOps.
Follow http://help.alertops.com/default.aspx/MyWiki/Errorception.html for setup detail.
31 changes: 31 additions & 0 deletions hooks/alertops/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var request = require("request"),
path = require("path");

exports.serviceName = "AlertOps";

exports.author = {
name: "Xinlin Ruan",
email: "[email protected]",
github: "AlertOps",
twitter: "AlertOps"
};

exports.onError = function(error, settings, done) {
request({
url: "https://notify.alertops.com/restapi.svc/POSTAlertV2/generic/"
+ settings.apiKey + "/Errorception/" + settings.sourceName
+ "/subject/id/none/none/webUrl/shortText/LongText/none",
method: "post",
body: JSON.stringify({
subject: "(Errorception) " + error.message,
id: path.basename(error.webUrl),
webUrl: error.webUrl,
shortText: "Error: " + error.message,
LongText: "An Error " + error.message + (error.isFirstOccurrence ? " occurred" : " recurred")
+ " at time: " + error.date
+ " in " + (error.isInline?("an inline script on " + error.page):error.scriptPath)
+ " See " + error.webUrl + " for details"
}),
timeout: 10000
}, done);
}