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