From da43e1b7072926e3b66bb17a377ec62558626728 Mon Sep 17 00:00:00 2001 From: Stephen Papierski Date: Wed, 1 Nov 2023 00:37:37 -0600 Subject: [PATCH] Add calculation method to just use last heartbeat --- server/model/monitor.js | 4 ++++ src/lang/en.json | 4 +++- src/pages/EditMonitor.vue | 8 +++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 8fde44c1f..596ca3057 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -1459,6 +1459,10 @@ class Monitor extends BeanModel { }); break; + case "last": + actualResponseTime = bean.ping + break; + default: log.error("monitor", `[${this.name}] Unknown slow response notification method ${method}`); return; diff --git a/src/lang/en.json b/src/lang/en.json index 2a42f711e..206331545 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -488,7 +488,7 @@ "slowResponseNotificationEnable": "Slow Response Notification", "slowResponseNotificationUseDescription": "Send a notification when service response time is slow.", "slowResponseNotificationThreshold": "Threshold (ms)", - "slowResponseNotificationThresholdDescription": "If response time greater than {0} ms, notify.", + "slowResponseNotificationThresholdDescription": "Send a notification if response time is greater than {0} ms.", "slowResponseNotificationRange": "Time Range (seconds)", "slowResponseNotificationRangeDescription": "Gets the heartbeat information for the last {0} seconds and calculates the condition.", "slowResponseNotificationMethod": "Calculation Method", @@ -496,6 +496,8 @@ "slowResponseNotificationMethodAverageDescription": "Get the average response time over the last {0} seconds.", "slowResponseNotificationMethodMax": "Max", "slowResponseNotificationMethodMaxDescription": "Get the max response time of the last {0} seconds.", + "slowResponseNotificationMethodLast": "Last", + "slowResponseNotificationMethodLastDescription": "Get the response time of the last heartbeat.", "slowResponseNotificationResendInterval": "Resend Notification if Slow Response X times consecutively", "notificationRegional": "Regional", "Clone Monitor": "Clone Monitor", diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 820c17a8c..bc553b0e6 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -439,6 +439,9 @@ +
{{ $t("slowResponseNotificationMethodAverageDescription", [monitor.slowResponseNotificationRange]) }} @@ -446,6 +449,9 @@
{{ $t("slowResponseNotificationMethodMaxDescription", [monitor.slowResponseNotificationRange]) }}
+
+ {{ $t("slowResponseNotificationMethodLastDescription", [monitor.slowResponseNotificationRange]) }} +
@@ -456,7 +462,7 @@
-
+