SSH subagent - using an alternative port (code/example)
-
looking at the 2.2.x source code in
./netxms/src/agent/subagents/sshin here, the handlers.cpp file defines the remote SSH port 22.
Also here are a group of parameters passed into H_SSHCommand()I am interested in variable/pointer set with this function
_tcschr(hostName, _T(':'));/** * Generic handler to execute command on any host */ LONG H_SSHCommand(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session) { TCHAR hostName[256], login[64], password[64], command[256]; if (!AgentGetParameterArg(param, 1, hostName, 256) || !AgentGetParameterArg(param, 2, login, 64) || !AgentGetParameterArg(param, 3, password, 64) || !AgentGetParameterArg(param, 4, command, 256)) return SYSINFO_RC_UNSUPPORTED; UINT16 port = 22; TCHAR *p = _tcschr(hostName, _T(':')); if (p != NULL) { *p = 0; p++; port = (UINT16)_tcstoul(p, NULL, 10); }We understand from documentation and from forums to use SSH.Command() -- Is anyone using the alternative port feature? I assume it should be used in DCI collection for Data Parameter (as an SSH origin) with this example:
SSH.Command(100.64.45.218:1916,tiger,lemur,"cat /tmp/run/stats/wireless.json")Is this accurate? a packet trace reveals port 22 is used

... The command above works for ./bin/nxget but not for DCI collection. For that, i simply enter the command "cat /tmp/run..." but nxms connects to port 22
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login