|
|
@ -13,9 +13,9 @@ class ZohoCliq extends NotificationProvider {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
_statusMessageFactory = (status, monitorName) => {
|
|
|
|
_statusMessageFactory = (status, monitorName) => {
|
|
|
|
if (status === DOWN) {
|
|
|
|
if (status === DOWN) {
|
|
|
|
return `🔴 Application [${monitorName}] went down\n`;
|
|
|
|
return `🔴 [${monitorName}] went down\n`;
|
|
|
|
} else if (status === UP) {
|
|
|
|
} else if (status === UP) {
|
|
|
|
return `✅ Application [${monitorName}] is back online\n`;
|
|
|
|
return `### ✅ [${monitorName}] is back online\n`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "Notification\n";
|
|
|
|
return "Notification\n";
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -46,16 +46,11 @@ class ZohoCliq extends NotificationProvider {
|
|
|
|
monitorUrl,
|
|
|
|
monitorUrl,
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const payload = [];
|
|
|
|
const payload = [];
|
|
|
|
payload.push("### Uptime Kuma\n");
|
|
|
|
|
|
|
|
payload.push(this._statusMessageFactory(status, monitorName));
|
|
|
|
payload.push(this._statusMessageFactory(status, monitorName));
|
|
|
|
payload.push(`*Description:* ${monitorMessage}`);
|
|
|
|
payload.push(`*Description:* ${monitorMessage}`);
|
|
|
|
|
|
|
|
|
|
|
|
if (monitorName) {
|
|
|
|
|
|
|
|
payload.push(`*Monitor:* ${monitorName}`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (monitorUrl && monitorUrl !== "https://") {
|
|
|
|
if (monitorUrl && monitorUrl !== "https://") {
|
|
|
|
payload.push(`*URL:* [${monitorUrl}](${monitorUrl})`);
|
|
|
|
payload.push(`*URL:* ${monitorUrl}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return payload;
|
|
|
|
return payload;
|
|
|
@ -87,24 +82,10 @@ class ZohoCliq extends NotificationProvider {
|
|
|
|
return okMsg;
|
|
|
|
return okMsg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let url;
|
|
|
|
|
|
|
|
switch (monitorJSON["type"]) {
|
|
|
|
|
|
|
|
case "http":
|
|
|
|
|
|
|
|
case "keywork":
|
|
|
|
|
|
|
|
url = monitorJSON["url"];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "docker":
|
|
|
|
|
|
|
|
url = monitorJSON["docker_host"];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
url = monitorJSON["hostname"];
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const payload = this._notificationPayloadFactory({
|
|
|
|
const payload = this._notificationPayloadFactory({
|
|
|
|
monitorMessage: heartbeatJSON.msg,
|
|
|
|
monitorMessage: heartbeatJSON.msg,
|
|
|
|
monitorName: monitorJSON.name,
|
|
|
|
monitorName: monitorJSON.name,
|
|
|
|
monitorUrl: url,
|
|
|
|
monitorUrl: this.extractAdress(monitorJSON),
|
|
|
|
status: heartbeatJSON.status
|
|
|
|
status: heartbeatJSON.status
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|