mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 16:14:53 +08:00
Use frontend timeout
Addresses https://github.com/louislam/uptime-kuma/pull/4717#discussion_r1585616669
This commit is contained in:
@@ -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,8 +91,13 @@ class SNMPMonitorType extends MonitorType {
|
||||
session.close();
|
||||
|
||||
} catch (err) {
|
||||
heartbeat.status = DOWN;
|
||||
heartbeat.msg = `SNMP Error: ${err.message}`;
|
||||
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();
|
||||
|
||||
|
Reference in New Issue
Block a user