mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-30 03:00:40 +00:00
Given that above throws, the else case is not nessesary
Co-Authored-By: Frank Elsinga <frank.elsinga@tum.de>
This commit is contained in:
parent
997791bc78
commit
1fe1bb5864
1 changed files with 32 additions and 34 deletions
|
@ -40,8 +40,7 @@ class SNMPMonitorType extends MonitorType {
|
||||||
if (varbinds.length === 0 || varbinds[0].type === snmp.ObjectType.NoSuchInstance) {
|
if (varbinds.length === 0 || varbinds[0].type === snmp.ObjectType.NoSuchInstance) {
|
||||||
throw new Error(`No varbinds returned from SNMP session (OID: ${monitor.snmpOid})`);
|
throw new Error(`No varbinds returned from SNMP session (OID: ${monitor.snmpOid})`);
|
||||||
|
|
||||||
// Varbinds succesfully returned
|
}
|
||||||
} else {
|
|
||||||
|
|
||||||
// We restrict querying to one OID per monitor, therefore `varbinds[0]` will always contain the value we're interested in.
|
// We restrict querying to one OID per monitor, therefore `varbinds[0]` will always contain the value we're interested in.
|
||||||
const value = varbinds[0].value;
|
const value = varbinds[0].value;
|
||||||
|
@ -74,7 +73,6 @@ class SNMPMonitorType extends MonitorType {
|
||||||
}
|
}
|
||||||
heartbeat.msg = "SNMP value " + (heartbeat.status ? "passes" : "does not pass") + ` comparison: ${value.toString()} ${monitor.snmpCondition} ${snmpControlValue}`;
|
heartbeat.msg = "SNMP value " + (heartbeat.status ? "passes" : "does not pass") + ` comparison: ${value.toString()} ${monitor.snmpCondition} ${snmpControlValue}`;
|
||||||
|
|
||||||
}
|
|
||||||
session.close();
|
session.close();
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in a new issue