added 'go-to' links to the remaining Discord notifications

This commit is contained in:
mospell committed 2025-11-23 17:18:09 +01:00
1 parent 8fb958e772
commit 90593c0d7c
1 file changed
+4 -6
@@ -114,12 +114,13 @@ class NotificationUtils {
{ name: "Monitor", value: monitor.name, inline: true }, { name: "Monitor", value: monitor.name, inline: true },
{ name: "URL", value: monitor.url, inline: false }, { name: "URL", value: monitor.url, inline: false },
]; ];
const goToIncidentField = { name: `Go to incident`, value: `${clientHost}/infrastructure/${monitor._id}` };
const formatDiscordAlert = { const formatDiscordAlert = {
cpu: () => ({ cpu: () => ({
title: "CPU alert", title: "CPU alert",
description: `Your current CPU usage (${(cpuUsage * 100).toFixed(0)}%) is above your threshold (${(cpuThreshold * 100).toFixed(0)}%)`, description: `Your current CPU usage (${(cpuUsage * 100).toFixed(0)}%) is above your threshold (${(cpuThreshold * 100).toFixed(0)}%)`,
color: 15548997, color: 15548997,
fields: monitorInfoFields, fields: [...monitorInfoFields, goToIncidentField],
footer: { text: "Checkmate" }, footer: { text: "Checkmate" },
}), }),
@@ -127,7 +128,7 @@ class NotificationUtils {
title: "Memory alert", title: "Memory alert",
description: `Your current memory usage (${(memoryUsage * 100).toFixed(0)}%) is above your threshold (${(memoryThreshold * 100).toFixed(0)}%)`, description: `Your current memory usage (${(memoryUsage * 100).toFixed(0)}%) is above your threshold (${(memoryThreshold * 100).toFixed(0)}%)`,
color: 15548997, color: 15548997,
fields: monitorInfoFields, fields: [...monitorInfoFields, goToIncidentField],
footer: { text: "Checkmate" }, footer: { text: "Checkmate" },
}), }),
@@ -143,10 +144,7 @@ class NotificationUtils {
value: `${(d?.usage_percent * 100).toFixed(0)}%`, value: `${(d?.usage_percent * 100).toFixed(0)}%`,
inline: true, inline: true,
})), })),
{ goToIncidentField,
name: `Go to incident`,
value: `${clientHost}/infrastructure/${monitor._id}`,
},
], ],
}), }),
}; };