|
|
@ -25,25 +25,29 @@ class Feishu extends NotificationProvider {
|
|
|
|
|
|
|
|
|
|
|
|
if (heartbeatJSON["status"] === DOWN) {
|
|
|
|
if (heartbeatJSON["status"] === DOWN) {
|
|
|
|
let downdata = {
|
|
|
|
let downdata = {
|
|
|
|
msg_type: "post",
|
|
|
|
msg_type: "interactive",
|
|
|
|
content: {
|
|
|
|
card: {
|
|
|
|
post: {
|
|
|
|
config: {
|
|
|
|
zh_cn: {
|
|
|
|
update_multi: false,
|
|
|
|
title: "UptimeKuma Alert: [Down] " + monitorJSON["name"],
|
|
|
|
wide_screen_mode: true,
|
|
|
|
content: [
|
|
|
|
},
|
|
|
|
[
|
|
|
|
header: {
|
|
|
|
{
|
|
|
|
title: {
|
|
|
|
tag: "text",
|
|
|
|
tag: "plain_text",
|
|
|
|
text:
|
|
|
|
content: "UptimeKuma Alert: [Down] " + monitorJSON["name"],
|
|
|
|
"[Down] " +
|
|
|
|
|
|
|
|
heartbeatJSON["msg"] +
|
|
|
|
|
|
|
|
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
template: "red",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
elements: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tag: "div",
|
|
|
|
|
|
|
|
text: {
|
|
|
|
|
|
|
|
tag: "lark_md",
|
|
|
|
|
|
|
|
content: getContent(heartbeatJSON),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
await axios.post(notification.feishuWebHookUrl, downdata);
|
|
|
|
await axios.post(notification.feishuWebHookUrl, downdata);
|
|
|
|
return okMsg;
|
|
|
|
return okMsg;
|
|
|
@ -51,25 +55,29 @@ class Feishu extends NotificationProvider {
|
|
|
|
|
|
|
|
|
|
|
|
if (heartbeatJSON["status"] === UP) {
|
|
|
|
if (heartbeatJSON["status"] === UP) {
|
|
|
|
let updata = {
|
|
|
|
let updata = {
|
|
|
|
msg_type: "post",
|
|
|
|
msg_type: "interactive",
|
|
|
|
content: {
|
|
|
|
card: {
|
|
|
|
post: {
|
|
|
|
config: {
|
|
|
|
zh_cn: {
|
|
|
|
update_multi: false,
|
|
|
|
title: "UptimeKuma Alert: [Up] " + monitorJSON["name"],
|
|
|
|
wide_screen_mode: true,
|
|
|
|
content: [
|
|
|
|
},
|
|
|
|
[
|
|
|
|
header: {
|
|
|
|
{
|
|
|
|
title: {
|
|
|
|
tag: "text",
|
|
|
|
tag: "plain_text",
|
|
|
|
text:
|
|
|
|
content: "UptimeKuma Alert: [UP] " + monitorJSON["name"],
|
|
|
|
"[Up] " +
|
|
|
|
|
|
|
|
heartbeatJSON["msg"] +
|
|
|
|
|
|
|
|
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
template: "green",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
elements: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tag: "div",
|
|
|
|
|
|
|
|
text: {
|
|
|
|
|
|
|
|
tag: "lark_md",
|
|
|
|
|
|
|
|
content: getContent(heartbeatJSON),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
await axios.post(notification.feishuWebHookUrl, updata);
|
|
|
|
await axios.post(notification.feishuWebHookUrl, updata);
|
|
|
|
return okMsg;
|
|
|
|
return okMsg;
|
|
|
@ -80,4 +88,17 @@ class Feishu extends NotificationProvider {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Get content
|
|
|
|
|
|
|
|
* @param {?object} heartbeatJSON Heartbeat details (For Up/Down only)
|
|
|
|
|
|
|
|
* @returns {string} Return Successful Message
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function getContent(heartbeatJSON) {
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
"**Message**: " + heartbeatJSON["msg"],
|
|
|
|
|
|
|
|
"**Ping**: " + (heartbeatJSON["ping"] == null ? "N/A" : heartbeatJSON["ping"] + " ms"),
|
|
|
|
|
|
|
|
`**Time (${heartbeatJSON["timezone"]})**: ${heartbeatJSON["localDateTime"]}`
|
|
|
|
|
|
|
|
].join("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = Feishu;
|
|
|
|
module.exports = Feishu;
|
|
|
|