Add calculation method to just use last heartbeat

This commit is contained in:
Stephen Papierski 2023-11-01 00:37:37 -06:00
parent 6c31994387
commit da43e1b707
3 changed files with 14 additions and 2 deletions

View file

@ -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;

View file

@ -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",

View file

@ -439,6 +439,9 @@
<option value="max">
{{ $t("slowResponseNotificationMethodMax") }}
</option>
<option value="last">
{{ $t("slowResponseNotificationMethodLast") }}
</option>
</select>
<div v-if="monitor.slowResponseNotificationMethod === 'average'" class="form-text">
{{ $t("slowResponseNotificationMethodAverageDescription", [monitor.slowResponseNotificationRange]) }}
@ -446,6 +449,9 @@
<div v-if="monitor.slowResponseNotificationMethod === 'max'" class="form-text">
{{ $t("slowResponseNotificationMethodMaxDescription", [monitor.slowResponseNotificationRange]) }}
</div>
<div v-if="monitor.slowResponseNotificationMethod === 'last'" class="form-text">
{{ $t("slowResponseNotificationMethodLastDescription", [monitor.slowResponseNotificationRange]) }}
</div>
</div>
<div v-if="monitor.slowResponseNotification" class="my-3">
@ -456,7 +462,7 @@
</div>
</div>
<div v-if="monitor.slowResponseNotification" class="my-3">
<div v-if="monitor.slowResponseNotification && monitor.slowResponseNotificationMethod !== 'last'" class="my-3">
<label for="slow-response-notification-range" class="form-label">{{ $t("slowResponseNotificationRange") }}</label>
<input id="slow-response-notification-range" v-model="monitor.slowResponseNotificationRange" type="number" class="form-control" required :min="monitor.interval" step="1">
<div class="form-text">