Skip to content

feat: replace monitorJSON.name with monitorJSON.pathName to display the monitors path, not just the root #5485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion server/notification-providers/aliyun-sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AliyunSMS extends NotificationProvider {
try {
if (heartbeatJSON != null) {
let msgBody = JSON.stringify({
name: monitorJSON["name"],
name: monitorJSON["pathName"],
time: heartbeatJSON["time"],
status: this.statusToString(heartbeatJSON["status"]),
msg: heartbeatJSON["msg"],
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/dingding.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DingDing extends NotificationProvider {
let params = {
msgtype: "markdown",
markdown: {
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["pathName"]}`,
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["pathName"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
},
"at": {
"isAtAll": notification.mentioning === "everyone"
Expand Down
8 changes: 4 additions & 4 deletions server/notification-providers/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class Discord extends NotificationProvider {
let discorddowndata = {
username: discordDisplayName,
embeds: [{
title: "❌ Your service " + monitorJSON["name"] + " went down. ❌",
title: "❌ Your service " + monitorJSON["pathName"] + " went down. ❌",
color: 16711680,
timestamp: heartbeatJSON["time"],
fields: [
{
name: "Service Name",
value: monitorJSON["name"],
value: monitorJSON["pathName"],
},
{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
Expand Down Expand Up @@ -75,13 +75,13 @@ class Discord extends NotificationProvider {
let discordupdata = {
username: discordDisplayName,
embeds: [{
title: "✅ Your service " + monitorJSON["name"] + " is up! ✅",
title: "✅ Your service " + monitorJSON["pathName"] + " is up! ✅",
color: 65280,
timestamp: heartbeatJSON["time"],
fields: [
{
name: "Service Name",
value: monitorJSON["name"],
value: monitorJSON["pathName"],
},
{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/feishu.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Feishu extends NotificationProvider {
header: {
title: {
tag: "plain_text",
content: "UptimeKuma Alert: [Down] " + monitorJSON["name"],
content: "UptimeKuma Alert: [Down] " + monitorJSON["pathName"],
},
template: "red",
},
Expand Down Expand Up @@ -64,7 +64,7 @@ class Feishu extends NotificationProvider {
header: {
title: {
tag: "plain_text",
content: "UptimeKuma Alert: [UP] " + monitorJSON["name"],
content: "UptimeKuma Alert: [UP] " + monitorJSON["pathName"],
},
template: "green",
},
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/google-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class GoogleChat extends NotificationProvider {
if (monitorJSON && heartbeatJSON) {
chatHeader["title"] =
heartbeatJSON["status"] === UP
? `✅ ${monitorJSON["name"]} is back online`
: `🔴 ${monitorJSON["name"]} went down`;
? `✅ ${monitorJSON["pathName"]} is back online`
: `🔴 ${monitorJSON["pathName"]} went down`;
}

// always show msg
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/grafana-oncall.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class GrafanaOncall extends NotificationProvider {
return okMsg;
} else if (heartbeatJSON["status"] === DOWN) {
let grafanadowndata = {
title: monitorJSON["name"] + " is down",
title: monitorJSON["pathName"] + " is down",
message: heartbeatJSON["msg"],
state: "alerting",
};
await axios.post(notification.GrafanaOncallURL, grafanadowndata);
return okMsg;
} else if (heartbeatJSON["status"] === UP) {
let grafanaupdata = {
title: monitorJSON["name"] + " is up",
title: monitorJSON["pathName"] + " is up",
message: heartbeatJSON["msg"],
state: "ok",
};
Expand Down
2 changes: 1 addition & 1 deletion server/notification-providers/home-assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HomeAssistant extends NotificationProvider {
title: "Uptime Kuma",
message: msg,
...(notificationService !== "persistent_notification" && { data: {
name: monitorJSON?.name,
name: monitorJSON?.pathName,
status: heartbeatJSON?.status,
channel: "Uptime Kuma",
icon_url: "https://github.com/louislam/uptime-kuma/blob/master/public/icon.png?raw=true",
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Line extends NotificationProvider {
{
"type": "text",
"text": "UptimeKuma Alert: [🔴 Down]\n" +
"Name: " + monitorJSON["name"] + " \n" +
"Name: " + monitorJSON["pathName"] + " \n" +
heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}
Expand All @@ -51,7 +51,7 @@ class Line extends NotificationProvider {
{
"type": "text",
"text": "UptimeKuma Alert: [✅ Up]\n" +
"Name: " + monitorJSON["name"] + " \n" +
"Name: " + monitorJSON["pathName"] + " \n" +
heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/linenotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class LineNotify extends NotificationProvider {
} else if (heartbeatJSON["status"] === DOWN) {
let downMessage = {
"message": "\n[🔴 Down]\n" +
"Name: " + monitorJSON["name"] + " \n" +
"Name: " + monitorJSON["pathName"] + " \n" +
heartbeatJSON["msg"] + "\n" +
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
};
await axios.post(url, qs.stringify(downMessage), config);
} else if (heartbeatJSON["status"] === UP) {
let upMessage = {
"message": "\n[✅ Up]\n" +
"Name: " + monitorJSON["name"] + " \n" +
"Name: " + monitorJSON["pathName"] + " \n" +
heartbeatJSON["msg"] + "\n" +
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
};
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/lunasea.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LunaSea extends NotificationProvider {

if (heartbeatJSON["status"] === DOWN) {
let downdata = {
"title": "UptimeKuma Alert: " + monitorJSON["name"],
"title": "UptimeKuma Alert: " + monitorJSON["pathName"],
"body": "[🔴 Down] " +
heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
Expand All @@ -36,7 +36,7 @@ class LunaSea extends NotificationProvider {

if (heartbeatJSON["status"] === UP) {
let updata = {
"title": "UptimeKuma Alert: " + monitorJSON["name"],
"title": "UptimeKuma Alert: " + monitorJSON["pathName"],
"body": "[✅ Up] " +
heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/ntfy.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Ntfy extends NotificationProvider {
if (heartbeatJSON == null) {
let ntfyTestData = {
"topic": notification.ntfytopic,
"title": (monitorJSON?.name || notification.ntfytopic) + " [Uptime-Kuma]",
"title": (monitorJSON?.pathName || notification.ntfytopic) + " [Uptime-Kuma]",
"message": msg,
"priority": notification.ntfyPriority,
"tags": [ "test_tube" ],
Expand All @@ -52,7 +52,7 @@ class Ntfy extends NotificationProvider {
"topic": notification.ntfytopic,
"message": heartbeatJSON.msg,
"priority": priority,
"title": monitorJSON.name + " " + status + " [Uptime-Kuma]",
"title": monitorJSON.pathName + " " + status + " [Uptime-Kuma]",
"tags": tags,
};

Expand Down
2 changes: 1 addition & 1 deletion server/notification-providers/opsgenie.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Opsgenie extends NotificationProvider {

if (heartbeatJSON.status === DOWN) {
let data = {
"message": monitorJSON ? textMsg + `: ${monitorJSON.name}` : textMsg,
"message": monitorJSON ? textMsg + `: ${monitorJSON.pathName}` : textMsg,
"alias": monitorJSON.name,
"description": msg,
"source": "Uptime Kuma",
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/pushbullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Pushbullet extends NotificationProvider {
} else if (heartbeatJSON["status"] === DOWN) {
let downData = {
"type": "note",
"title": "UptimeKuma Alert: " + monitorJSON["name"],
"title": "UptimeKuma Alert: " + monitorJSON["pathName"],
"body": "[🔴 Down] " +
heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
Expand All @@ -39,7 +39,7 @@ class Pushbullet extends NotificationProvider {
} else if (heartbeatJSON["status"] === UP) {
let upData = {
"type": "note",
"title": "UptimeKuma Alert: " + monitorJSON["name"],
"title": "UptimeKuma Alert: " + monitorJSON["pathName"],
"body": "[✅ Up] " +
heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/pushdeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class PushDeer extends NotificationProvider {

let title;
if (valid && heartbeatJSON.status === UP) {
title = "## Uptime Kuma: " + monitorJSON.name + " up";
title = "## Uptime Kuma: " + monitorJSON.pathName + " up";
} else if (valid && heartbeatJSON.status === DOWN) {
title = "## Uptime Kuma: " + monitorJSON.name + " down";
title = "## Uptime Kuma: " + monitorJSON.pathName + " down";
} else {
title = "## Uptime Kuma Message";
}
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/serverchan.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class ServerChan extends NotificationProvider {
checkStatus(heartbeatJSON, monitorJSON) {
let title = "UptimeKuma Message";
if (heartbeatJSON != null && heartbeatJSON["status"] === UP) {
title = "UptimeKuma Monitor Up " + monitorJSON["name"];
title = "UptimeKuma Monitor Up " + monitorJSON["pathName"];
}
if (heartbeatJSON != null && heartbeatJSON["status"] === DOWN) {
title = "UptimeKuma Monitor Down " + monitorJSON["name"];
title = "UptimeKuma Monitor Down " + monitorJSON["pathName"];
}
return title;
}
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/sevenio.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class SevenIO extends NotificationProvider {

// If heartbeatJSON is not null, we go into the normal alerting loop.
if (heartbeatJSON["status"] === DOWN) {
data.text = `Your service ${monitorJSON["name"]} ${address}went down at ${heartbeatJSON["localDateTime"]} ` +
data.text = `Your service ${monitorJSON["pathName"]} ${address}went down at ${heartbeatJSON["localDateTime"]} ` +
`(${heartbeatJSON["timezone"]}). Error: ${heartbeatJSON["msg"]}`;
} else if (heartbeatJSON["status"] === UP) {
data.text = `Your service ${monitorJSON["name"]} ${address}went back up at ${heartbeatJSON["localDateTime"]} ` +
data.text = `Your service ${monitorJSON["pathName"]} ${address}went back up at ${heartbeatJSON["localDateTime"]} ` +
`(${heartbeatJSON["timezone"]}).`;
}
await axios.post("sms", data, config);
Expand Down
2 changes: 1 addition & 1 deletion server/notification-providers/smtp.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class SMTP extends NotificationProvider {
let monitorHostnameOrURL = "testing.hostname";

if (monitorJSON !== null) {
monitorName = monitorJSON["name"];
monitorName = monitorJSON["pathName"];
monitorHostnameOrURL = this.extractAddress(monitorJSON);
}

Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/squadcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class Squadcast extends NotificationProvider {
data.event_id = heartbeatJSON["monitorID"];

if (heartbeatJSON["status"] === DOWN) {
data.message = `${monitorJSON["name"]} is DOWN`;
data.message = `${monitorJSON["pathName"]} is DOWN`;
data.status = "trigger";
} else {
data.message = `${monitorJSON["name"]} is UP`;
data.message = `${monitorJSON["pathName"]} is UP`;
data.status = "resolve";
}

Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/stackfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Stackfield extends NotificationProvider {

let textMsg = "+Uptime Kuma Alert+";

if (monitorJSON && monitorJSON.name) {
textMsg += `\n*${monitorJSON.name}*`;
if (monitorJSON && monitorJSON.pathName) {
textMsg += `\n*${monitorJSON.pathName}*`;
}

textMsg += `\n${msg}`;
Expand Down
4 changes: 2 additions & 2 deletions server/notification-providers/wpush.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class WPush extends NotificationProvider {
checkStatus(heartbeatJSON, monitorJSON) {
let title = "UptimeKuma Message";
if (heartbeatJSON != null && heartbeatJSON["status"] === UP) {
title = "UptimeKuma Monitor Up " + monitorJSON["name"];
title = "UptimeKuma Monitor Up " + monitorJSON["pathName"];
}
if (heartbeatJSON != null && heartbeatJSON["status"] === DOWN) {
title = "UptimeKuma Monitor Down " + monitorJSON["name"];
title = "UptimeKuma Monitor Down " + monitorJSON["pathName"];
}
return title;
}
Expand Down
Loading