diff --git a/server/monitor-types/snmp.js b/server/monitor-types/snmp.js index 7b30a6174..dcf02e1c0 100644 --- a/server/monitor-types/snmp.js +++ b/server/monitor-types/snmp.js @@ -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}`; + } } } diff --git a/server/server.js b/server/server.js index 206745813..7a147fce6 100644 --- a/server/server.js +++ b/server/server.js @@ -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(); diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index a6ae1250b..cf15677cd 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -506,8 +506,8 @@ - -