mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-06 21:12:34 +02:00
refactor: upload check label when monitor empty
This commit is contained in:
parent
c4e222d1e6
commit
6346e0db52
1 changed files with 12 additions and 3 deletions
|
@ -59,6 +59,17 @@ class FlashDuty extends NotificationProvider {
|
|||
* @returns {string}
|
||||
*/
|
||||
async postNotification(notification, title, body, monitorInfo, eventStatus) {
|
||||
let labels = {
|
||||
resource: this.genMonitorUrl(monitorInfo),
|
||||
check: monitorInfo.name,
|
||||
};
|
||||
if (monitorInfo?.tags?.length > 0) {
|
||||
labels = monitorInfo?.tags?.reduce(
|
||||
(acc, item) => ({ ...acc,
|
||||
[item.name]: item.value }),
|
||||
labels
|
||||
);
|
||||
}
|
||||
const options = {
|
||||
method: "POST",
|
||||
url: "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey,
|
||||
|
@ -68,9 +79,7 @@ class FlashDuty extends NotificationProvider {
|
|||
title,
|
||||
event_status: eventStatus || "Info",
|
||||
alert_key: String(monitorInfo.id) || Math.random().toString(36).substring(7),
|
||||
labels: monitorInfo?.tags?.reduce((acc, item) => ({ ...acc,
|
||||
[item.name]: item.value
|
||||
}), { resource: this.genMonitorUrl(monitorInfo) }),
|
||||
labels,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue