Hello,
In response to the infrastructure needs of our company's service, I've created a small API that sends SNMP queries to InterSystems to visualize relevant data for retrieval when the infrastructure implements monitoring.
However, I'm experiencing a timeout issue when attempting to collect information using an SNMP walk. Here is the code for my API's SNMP service:
import snmp from "net-snmp";
const options = {
port: 161,
retries: 4,
timeout: 3000,
transport: "udp4",
trapPort: 162
};
const oids = [ "1.3.6.1.4.1.16563.4.1.15.1.4" ];
export const testWalk = () => {
const session = snmp.createSession("localhost", "public", options);
console.log("Session created");
session.walk(oids[0], null, (error, varbinds) => {
if (error) {
console.log("error: " + error);
} else {
for (let i = 0; i < varbinds.length; i++) {
if (snmp.isVarbindError(varbinds[i])) {
console.log(snmp.varbindError(varbinds[i]));
} else {
console.log(varbinds[i].oid + " = " + varbinds[i].value);
}
}
}
session.close()
});
};
I do have the 'session created' console.log, so I am able to successfully create the SNMP session. However, I encounter this error: 'error: RequestTimedOutError: Request timed out.' The OID corresponds to retrieving irisProdStatus (Current status of all existing productions, of which I have around ten).
I have tried both udp4 and udp6 transport methods. For session creation, I've attempted using localhost as well as 127.0.0.1.
I have InterSystems running in a local Docker container (with the network configured to be on the same 'local network' as my API). Here is my docker-compose file so that you can verify that the correct ports are open :
version: '3.8'
services:
iris:
build:
context: .
dockerfile: Dockerfile
target: final
restart: always
command: --check-caps false --ISCAgent false
ports:
- 161:161/udp
- 162:162/udp
- 705:705
- 1972:1972
- 52773:52773
- 53773:53773
volumes:
- ./:/home/irisowner/dev
network_mode: bridge
On the InterSystems portal, I have enabled the %Service_Monitor service and checked the 'Start SNMP agent at system startup' checkbox.
I noticed after some research that Net-SNMP on Linux does not enable TCP port 705 by default, hence this error:
.png)
I followed these points from the documentation:
.png)
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...
However, I still can't start the snmpd service in the Docker container.
Did I miss anything? Is the SNMP library I'm using functioning correctly?
Thanks in advance for your feedback!
Best regards,
Cyril