|
|
@ -1,6 +1,6 @@
|
|
|
|
const NotificationProvider = require("./notification-provider");
|
|
|
|
const NotificationProvider = require("./notification-provider");
|
|
|
|
const axios = require("axios");
|
|
|
|
const axios = require("axios");
|
|
|
|
const { DOWN, UP } = require("../../src/util");
|
|
|
|
const { DOWN } = require("../../src/util");
|
|
|
|
|
|
|
|
|
|
|
|
class Squadcast extends NotificationProvider {
|
|
|
|
class Squadcast extends NotificationProvider {
|
|
|
|
|
|
|
|
|
|
|
@ -14,21 +14,21 @@ class Squadcast extends NotificationProvider {
|
|
|
|
let config = {};
|
|
|
|
let config = {};
|
|
|
|
let data = {
|
|
|
|
let data = {
|
|
|
|
message: msg,
|
|
|
|
message: msg,
|
|
|
|
description: '',
|
|
|
|
description: "",
|
|
|
|
tags: {},
|
|
|
|
tags: {},
|
|
|
|
heartbeat: heartbeatJSON,
|
|
|
|
heartbeat: heartbeatJSON,
|
|
|
|
source: 'uptime-kuma'
|
|
|
|
source: "uptime-kuma"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (heartbeatJSON !== null) {
|
|
|
|
if (heartbeatJSON !== null) {
|
|
|
|
data.description = heartbeatJSON["msg"];
|
|
|
|
data.description = heartbeatJSON["msg"];
|
|
|
|
data.event_id = heartbeatJSON["monitorID"];
|
|
|
|
data.event_id = heartbeatJSON["monitorID"];
|
|
|
|
|
|
|
|
|
|
|
|
if (heartbeatJSON["status"] === DOWN) {
|
|
|
|
if (heartbeatJSON["status"] === DOWN) {
|
|
|
|
data.message = `${monitorJSON['name']} is DOWN`;
|
|
|
|
data.message = `${monitorJSON["name"]} is DOWN`;
|
|
|
|
data.status = "trigger";
|
|
|
|
data.status = "trigger";
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
data.message = `${monitorJSON['name']} is UP`;
|
|
|
|
data.message = `${monitorJSON["name"]} is UP`;
|
|
|
|
data.status = "resolve";
|
|
|
|
data.status = "resolve";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -57,7 +57,7 @@ class Squadcast extends NotificationProvider {
|
|
|
|
value: tag["value"]
|
|
|
|
value: tag["value"]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (tag["color"] !== null) {
|
|
|
|
if (tag["color"] !== null) {
|
|
|
|
data.tags[tag["name"]]["color"] = tag["color"]
|
|
|
|
data.tags[tag["name"]]["color"] = tag["color"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -73,4 +73,4 @@ class Squadcast extends NotificationProvider {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = Squadcast;
|
|
|
|
module.exports = Squadcast;
|
|
|
|