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