Skip to content

Commit 13757c4

Browse files
unknownunknown
authored andcommitted
Initial commit
1 parent de9f27a commit 13757c4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

hooks/alertops/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
AlertOps
2+
3+
Sends a error event to AlertOps.
4+
Follow http://help.alertops.com/default.aspx/MyWiki/Errorception.html for setup detail.

hooks/alertops/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var request = require("request"),
2+
path = require("path");
3+
4+
exports.serviceName = "AlertOps";
5+
6+
exports.author = {
7+
name: "Xinlin Ruan",
8+
9+
github: "AlertOps",
10+
twitter: "AlertOps"
11+
};
12+
13+
exports.onError = function(error, settings, done) {
14+
request({
15+
url: "https://notify.alertops.com/restapi.svc/POSTAlertV2/generic/"
16+
+ settings.apiKey + "/Errorception/" + settings.sourceName
17+
+ "/subject/id/none/none/webUrl/shortText/LongText",
18+
method: "post",
19+
body: JSON.stringify({
20+
subject: "(Errorception) " + error.message,
21+
id: path.basename(error.webUrl),
22+
webUrl: error.webUrl,
23+
shortText: "Error: " + error.message + " at time: " + error.date,
24+
LongText: "An Error " + error.message + (error.isFirstOccurrence ? "occurred" : "recurred") + " in "
25+
+ (error.isInline?("an inline script on " + error.page):error.scriptPath)
26+
+ " See " + error.webUrl + " for details"
27+
}),
28+
timeout: 10000
29+
}, done);
30+
}

0 commit comments

Comments
 (0)