mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-07 21:42:34 +02:00
fix(monitor-checks): don't throw on 4xx errors
This commit is contained in:
parent
c6a8d555cf
commit
b0d2084fda
1 changed files with 1 additions and 21 deletions
|
@ -144,6 +144,7 @@ class Monitor extends BeanModel {
|
||||||
rejectUnauthorized: ! this.getIgnoreTls(),
|
rejectUnauthorized: ! this.getIgnoreTls(),
|
||||||
}),
|
}),
|
||||||
maxRedirects: this.maxredirects,
|
maxRedirects: this.maxredirects,
|
||||||
|
validateStatus: undefined,
|
||||||
});
|
});
|
||||||
bean.msg = `${res.status} - ${res.statusText}`;
|
bean.msg = `${res.status} - ${res.statusText}`;
|
||||||
bean.ping = dayjs().valueOf() - startTime;
|
bean.ping = dayjs().valueOf() - startTime;
|
||||||
|
@ -162,28 +163,7 @@ class Monitor extends BeanModel {
|
||||||
|
|
||||||
debug("Cert Info Query Time: " + (dayjs().valueOf() - certInfoStartTime) + "ms");
|
debug("Cert Info Query Time: " + (dayjs().valueOf() - certInfoStartTime) + "ms");
|
||||||
|
|
||||||
|
|
||||||
validateMonitorChecks(res, await this.getMonitorChecks(), bean);
|
validateMonitorChecks(res, await this.getMonitorChecks(), bean);
|
||||||
if (this.type === "http") {
|
|
||||||
bean.status = UP;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
let data = res.data;
|
|
||||||
|
|
||||||
// Convert to string for object/array
|
|
||||||
if (typeof data !== "string") {
|
|
||||||
data = JSON.stringify(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.includes(this.keyword)) {
|
|
||||||
bean.msg += ", keyword is found";
|
|
||||||
bean.status = UP;
|
|
||||||
} else {
|
|
||||||
throw new Error(bean.msg + ", but keyword is not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (this.type === "port") {
|
} else if (this.type === "port") {
|
||||||
bean.ping = await tcping(this.hostname, this.port);
|
bean.ping = await tcping(this.hostname, this.port);
|
||||||
bean.msg = "";
|
bean.msg = "";
|
||||||
|
|
Loading…
Add table
Reference in a new issue