mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-24 22:14:47 +02:00
Added support for a retry interval to monitors
If a check fails and retries are used you can now specify a specific value for that. So you can check faster if the site goes back up again.
This commit is contained in:
parent
6caae725f9
commit
f8f9f59464
7
db/patch-add-retry-interval-monitor.sql
Normal file
7
db/patch-add-retry-interval-monitor.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD retry_interval INTEGER default 0 not null;
|
||||||
|
|
||||||
|
COMMIT;
|
@ -30,6 +30,7 @@ class Database {
|
|||||||
static patchList = {
|
static patchList = {
|
||||||
"patch-setting-value-type.sql": true,
|
"patch-setting-value-type.sql": true,
|
||||||
"patch-improve-performance.sql": true,
|
"patch-improve-performance.sql": true,
|
||||||
|
"patch-add-retry-interval-monitor.sql": true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,6 +43,7 @@ class Monitor extends BeanModel {
|
|||||||
active: this.active,
|
active: this.active,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
interval: this.interval,
|
interval: this.interval,
|
||||||
|
retryInterval: this.retryInterval,
|
||||||
keyword: this.keyword,
|
keyword: this.keyword,
|
||||||
ignoreTls: this.getIgnoreTls(),
|
ignoreTls: this.getIgnoreTls(),
|
||||||
upsideDown: this.isUpsideDown(),
|
upsideDown: this.isUpsideDown(),
|
||||||
@ -293,12 +294,17 @@ class Monitor extends BeanModel {
|
|||||||
bean.important = false;
|
bean.important = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let beatInterval = this.interval;
|
||||||
|
|
||||||
if (bean.status === UP) {
|
if (bean.status === UP) {
|
||||||
console.info(`Monitor #${this.id} '${this.name}': Successful Response: ${bean.ping} ms | Interval: ${this.interval} seconds | Type: ${this.type}`)
|
console.info(`Monitor #${this.id} '${this.name}': Successful Response: ${bean.ping} ms | Interval: ${beatInterval} seconds | Type: ${this.type}`)
|
||||||
} else if (bean.status === PENDING) {
|
} else if (bean.status === PENDING) {
|
||||||
console.warn(`Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Type: ${this.type}`)
|
if (this.retryInterval > 0) {
|
||||||
|
beatInterval = this.retryInterval;
|
||||||
|
}
|
||||||
|
console.warn(`Monitor #${this.id} '${this.name}': Pending: ${bean.msg} | Max retries: ${this.maxretries} | Retry: ${retries} | Retry Interval: ${beatInterval} seconds | Type: ${this.type}`)
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Type: ${this.type}`)
|
console.warn(`Monitor #${this.id} '${this.name}': Failing: ${bean.msg} | Interval: ${beatInterval} seconds | Type: ${this.type}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
io.to(this.user_id).emit("heartbeat", bean.toJSON());
|
io.to(this.user_id).emit("heartbeat", bean.toJSON());
|
||||||
@ -310,7 +316,7 @@ class Monitor extends BeanModel {
|
|||||||
previousBeat = bean;
|
previousBeat = bean;
|
||||||
|
|
||||||
if (! this.isStop) {
|
if (! this.isStop) {
|
||||||
this.heartbeatInterval = setTimeout(beat, this.interval * 1000);
|
this.heartbeatInterval = setTimeout(beat, beatInterval * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -324,6 +324,7 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
|
|||||||
bean.type = monitor.type
|
bean.type = monitor.type
|
||||||
bean.url = monitor.url
|
bean.url = monitor.url
|
||||||
bean.interval = monitor.interval
|
bean.interval = monitor.interval
|
||||||
|
bean.retryInterval = monitor.retryInterval;
|
||||||
bean.hostname = monitor.hostname;
|
bean.hostname = monitor.hostname;
|
||||||
bean.maxretries = monitor.maxretries;
|
bean.maxretries = monitor.maxretries;
|
||||||
bean.port = monitor.port;
|
bean.port = monitor.port;
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
export default {
|
export default {
|
||||||
languageName: "English",
|
languageName: "English",
|
||||||
checkEverySecond: "Check every {0} seconds.",
|
checkEverySecond: "Check every {0} seconds.",
|
||||||
|
retryCheckEverySecond: "Retry every {0} seconds.",
|
||||||
"Avg.": "Avg. ",
|
"Avg.": "Avg. ",
|
||||||
retriesDescription: "Maximum retries before the service is marked as down and a notification is sent",
|
retriesDescription: "Maximum retries before the service is marked as down and a notification is sent",
|
||||||
|
retryIntervalInactive: "Inactive",
|
||||||
|
retryIntervalDescription: "If retries are and used this value is greater then zero this interval will be used instead.",
|
||||||
ignoreTLSError: "Ignore TLS/SSL error for HTTPS websites",
|
ignoreTLSError: "Ignore TLS/SSL error for HTTPS websites",
|
||||||
upsideDownModeDescription: "Flip the status upside down. If the service is reachable, it is DOWN.",
|
upsideDownModeDescription: "Flip the status upside down. If the service is reachable, it is DOWN.",
|
||||||
maxRedirectDescription: "Maximum number of redirects to follow. Set to 0 to disable redirects.",
|
maxRedirectDescription: "Maximum number of redirects to follow. Set to 0 to disable redirects.",
|
||||||
@ -64,6 +67,7 @@ export default {
|
|||||||
Port: "Port",
|
Port: "Port",
|
||||||
"Heartbeat Interval": "Heartbeat Interval",
|
"Heartbeat Interval": "Heartbeat Interval",
|
||||||
Retries: "Retries",
|
Retries: "Retries",
|
||||||
|
"Heartbeat Retry Interval": "Heartbeat Retry Interval",
|
||||||
Advanced: "Advanced",
|
Advanced: "Advanced",
|
||||||
"Upside Down Mode": "Upside Down Mode",
|
"Upside Down Mode": "Upside Down Mode",
|
||||||
"Max. Redirects": "Max. Redirects",
|
"Max. Redirects": "Max. Redirects",
|
||||||
|
@ -106,6 +106,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="my-3">
|
||||||
|
<label for="retry-interval" class="form-label">
|
||||||
|
{{ $t("Heartbeat Retry Interval") }}
|
||||||
|
<span v-if="monitor.retryInterval > 0">({{ $t("retryCheckEverySecond", [ monitor.retryInterval ]) }})</span>
|
||||||
|
<span v-else>({{ $t("retryIntervalInactive") }})</span>
|
||||||
|
</label>
|
||||||
|
<input id="retry-interval" v-model="monitor.retryInterval" type="number" class="form-control" required min="0" step="1">
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("retryIntervalDescription") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2 class="mt-5 mb-2">{{ $t("Advanced") }}</h2>
|
<h2 class="mt-5 mb-2">{{ $t("Advanced") }}</h2>
|
||||||
|
|
||||||
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' " class="my-3 form-check">
|
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' " class="my-3 form-check">
|
||||||
@ -289,6 +301,7 @@ export default {
|
|||||||
name: "",
|
name: "",
|
||||||
url: "https://",
|
url: "https://",
|
||||||
interval: 60,
|
interval: 60,
|
||||||
|
retryInterval: 0,
|
||||||
maxretries: 0,
|
maxretries: 0,
|
||||||
notificationIDList: {},
|
notificationIDList: {},
|
||||||
ignoreTls: false,
|
ignoreTls: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user