diff --git a/server/notification-providers/pagerduty.js b/server/notification-providers/pagerduty.js index c60d782e7..385ad2af0 100644 --- a/server/notification-providers/pagerduty.js +++ b/server/notification-providers/pagerduty.js @@ -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,