mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
refactor: upload check label when monitor empty (#3661)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
668e8bafed
commit
168d1ca24f
2 changed files with 11 additions and 4 deletions
|
@ -62,6 +62,15 @@ class FlashDuty extends NotificationProvider {
|
||||||
* @returns {string} Success message
|
* @returns {string} Success message
|
||||||
*/
|
*/
|
||||||
async postNotification(notification, title, body, monitorInfo, eventStatus) {
|
async postNotification(notification, title, body, monitorInfo, eventStatus) {
|
||||||
|
let labels = {
|
||||||
|
resource: this.genMonitorUrl(monitorInfo),
|
||||||
|
check: monitorInfo.name,
|
||||||
|
};
|
||||||
|
if (monitorInfo.tags && monitorInfo.tags.length > 0) {
|
||||||
|
for (let tag of monitorInfo.tags) {
|
||||||
|
labels[tag.name] = tag.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
const options = {
|
const options = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey,
|
url: "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey,
|
||||||
|
@ -71,9 +80,7 @@ class FlashDuty extends NotificationProvider {
|
||||||
title,
|
title,
|
||||||
event_status: eventStatus || "Info",
|
event_status: eventStatus || "Info",
|
||||||
alert_key: String(monitorInfo.id) || Math.random().toString(36).substring(7),
|
alert_key: String(monitorInfo.id) || Math.random().toString(36).substring(7),
|
||||||
labels: monitorInfo?.tags?.reduce((acc, item) => ({ ...acc,
|
labels,
|
||||||
[item.name]: item.value
|
|
||||||
}), { resource: this.genMonitorUrl(monitorInfo) }),
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@
|
||||||
"noGroupMonitorMsg": "Not Available. Create a Group Monitor First.",
|
"noGroupMonitorMsg": "Not Available. Create a Group Monitor First.",
|
||||||
"Close": "Close",
|
"Close": "Close",
|
||||||
"Request Body": "Request Body",
|
"Request Body": "Request Body",
|
||||||
"wayToGetFlashDutyKey": "You can go to Channel -> (Select a Channel) -> Integrations -> Add a new integration' page, add a 'Custom Event' to get a push address, copy the Integration Key in the address. For more information, please visit",
|
"wayToGetFlashDutyKey": "You can go to Channel -> (Select a Channel) -> Integrations -> Add a new integration' page, add a 'Uptime Kuma' to get a push address, copy the Integration Key in the address. For more information, please visit",
|
||||||
"FlashDuty Severity": "Severity",
|
"FlashDuty Severity": "Severity",
|
||||||
"nostrRelays": "Nostr relays",
|
"nostrRelays": "Nostr relays",
|
||||||
"nostrRelaysHelp": "One relay URL per line",
|
"nostrRelaysHelp": "One relay URL per line",
|
||||||
|
|
Loading…
Reference in a new issue