looking at the 2.2.x source code in ./netxms/src/agent/subagents/ssh
in 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