Remove unnecessary func getKey

This commit is contained in:
Matt Visnovsky 2024-05-06 12:05:12 -06:00
parent 6037912085
commit c68b1c6274

View file

@ -1,5 +1,5 @@
const { MonitorType } = require("./monitor-type");
const { UP, DOWN, log, getKey } = require("../../src/util");
const { UP, DOWN, log } = require("../../src/util");
const snmp = require("net-snmp");
class SNMPMonitorType extends MonitorType {
@ -14,7 +14,7 @@ class SNMPMonitorType extends MonitorType {
port: monitor.port || "161",
retries: monitor.maxretries,
timeout: monitor.timeout * 1000,
version: monitor.snmpVersion,
version: parseInt(monitor.snmpVersion),
};
try {
@ -34,7 +34,7 @@ class SNMPMonitorType extends MonitorType {
}
});
});
log.debug("monitor", `SNMP: Received varbinds (Type=${getKey(snmp.ObjectType, varbinds[0].type)}): ${varbinds[0].value}`);
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) {