Fix do nothing erroneous api call for Pagerduty (#6231)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
maldotcom2 2025-10-28 08:09:21 +11:00 committed by GitHub
parent ea3a4f6963
commit 38ec3bc432
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,9 +23,7 @@ class PagerDuty extends NotificationProvider {
if (heartbeatJSON.status === UP) {
const title = "Uptime Kuma Monitor ✅ Up";
const eventAction = notification.pagerdutyAutoResolve || null;
return this.postNotification(notification, title, heartbeatJSON.msg, monitorJSON, eventAction);
return this.postNotification(notification, title, heartbeatJSON.msg, monitorJSON, "resolve");
}
if (heartbeatJSON.status === DOWN) {
@ -63,10 +61,6 @@ class PagerDuty extends NotificationProvider {
*/
async postNotification(notification, title, body, monitorInfo, eventAction = "trigger") {
if (eventAction == null) {
return "No action required";
}
let monitorUrl;
if (monitorInfo.type === "port") {
monitorUrl = monitorInfo.hostname;
@ -79,6 +73,13 @@ class PagerDuty extends NotificationProvider {
monitorUrl = monitorInfo.url;
}
if (eventAction === "resolve") {
if (notification.pagerdutyAutoResolve === "0") {
return "no action required";
}
eventAction = notification.pagerdutyAutoResolve;
}
const options = {
method: "POST",
url: notification.pagerdutyIntegrationUrl,