mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-12-10 00:30:23 -06:00
Fix do nothing erroneous api call for Pagerduty (#6231)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
ea3a4f6963
commit
38ec3bc432
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user