mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Use frontend timeout
Addresses https://github.com/louislam/uptime-kuma/pull/4717#discussion_r1585616669
This commit is contained in:
parent
d83c2b90c9
commit
f059d54349
3 changed files with 18 additions and 6 deletions
|
@ -13,7 +13,7 @@ class SNMPMonitorType extends MonitorType {
|
|||
const options = {
|
||||
port: monitor.port || "161",
|
||||
retries: monitor.maxretries,
|
||||
timeout: 1000,
|
||||
timeout: monitor.timeout * 1000,
|
||||
version: getKey(snmp.Version, monitor.snmpVersion) || snmp.Version2c,
|
||||
};
|
||||
|
||||
|
@ -91,10 +91,15 @@ class SNMPMonitorType extends MonitorType {
|
|||
session.close();
|
||||
|
||||
} catch (err) {
|
||||
if (err instanceof snmp.RequestTimedOutError) {
|
||||
heartbeat.status = DOWN;
|
||||
heartbeat.msg = `SNMP Error: Timed out after ${monitor.timeout} seconds`;
|
||||
} else {
|
||||
heartbeat.status = DOWN;
|
||||
heartbeat.msg = `SNMP Error: ${err.message}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -835,6 +835,7 @@ let needSetup = false;
|
|||
bean.snmpOid = monitor.snmpOid;
|
||||
bean.snmpCondition = monitor.snmpCondition;
|
||||
bean.snmpControlValue = monitor.snmpControlValue;
|
||||
bean.timeout = monitor.timeout;
|
||||
|
||||
bean.validate();
|
||||
|
||||
|
|
|
@ -506,8 +506,8 @@
|
|||
<input id="retry-interval" v-model="monitor.retryInterval" type="number" class="form-control" required :min="minInterval" step="1">
|
||||
</div>
|
||||
|
||||
<!-- Timeout: HTTP / Keyword only -->
|
||||
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query'" class="my-3">
|
||||
<!-- Timeout: HTTP / Keyword / SNMP only -->
|
||||
<div v-if="monitor.type === 'http' || monitor.type === 'keyword' || monitor.type === 'json-query' || monitor.type === 'snmp'" class="my-3">
|
||||
<label for="timeout" class="form-label">{{ $t("Request Timeout") }} ({{ $t("timeoutAfter", [ monitor.timeout || clampTimeout(monitor.interval) ]) }})</label>
|
||||
<input id="timeout" v-model="monitor.timeout" type="number" class="form-control" required min="0" step="0.1">
|
||||
</div>
|
||||
|
@ -969,7 +969,6 @@ const monitorDefaults = {
|
|||
retryInterval: 60,
|
||||
resendInterval: 0,
|
||||
maxretries: 0,
|
||||
timeout: 48,
|
||||
notificationIDList: {},
|
||||
ignoreTls: false,
|
||||
upsideDown: false,
|
||||
|
@ -1321,6 +1320,13 @@ message HealthCheckResponse {
|
|||
}
|
||||
}
|
||||
|
||||
// Set default timeout
|
||||
if (this.monitor.type === "snmp") {
|
||||
this.monitor.timeout = 1;
|
||||
} else {
|
||||
this.monitor.timeout = 48;
|
||||
}
|
||||
|
||||
// Set default SNMP version
|
||||
if (!this.monitor.snmpVersion) {
|
||||
this.monitor.snmpVersion = "2c";
|
||||
|
|
Loading…
Reference in a new issue