diff --git a/server/monitor-types/snmp.js b/server/monitor-types/snmp.js index 3a734d2cf..f660df538 100644 --- a/server/monitor-types/snmp.js +++ b/server/monitor-types/snmp.js @@ -36,10 +36,14 @@ class SNMPMonitorType extends MonitorType { }); log.debug("monitor", `SNMP: Received varbinds (Type: ${snmp.ObjectType[varbinds[0].type]} Value: ${varbinds[0].value}`); - // Verify if any varbinds were returned from the SNMP session or if the varbind type indicates a non-existent instance. - if (varbinds.length === 0 || varbinds[0].type === snmp.ObjectType.NoSuchInstance) { + // Verify if any varbinds were returned from the SNMP session. + if (varbinds.length === 0) { throw new Error(`No varbinds returned from SNMP session (OID: ${monitor.snmpOid})`); + } + // Check if the varbind type indicates a non-existent instance. + if (varbinds[0].type === snmp.ObjectType.NoSuchInstance) { + throw new Error(`The SNMP query was successful but no varbinds returned for OID: ${monitor.snmpOid}`); } // We restrict querying to one OID per monitor, therefore `varbinds[0]` will always contain the value we're interested in.