monitoring space on remote HDD over SSH

Started by ZAJDAN, May 07, 2020, 06:11:04 PM

Previous topic - Next topic

ZAJDAN

Hi...
I have remote HDD and I have not possibility install Agent on the machine where is the HDD.
Is anyhow possible create SSH connection to such drive and run there command or script?

Thank You for any hint
Regards ZAJDAN

Filipp Sudanov

Absolutely, please check NetXMS docs on that: https://www.netxms.org/documentation/adminguide/ssh-monitoring.html
Make sure you add ssh.nsm subagent to the configuratio file of netxms agent running on your netxms server and restart the agent afterwards.

ZAJDAN

#2
OK...
1) On the NetXMS server I found /etc/nxagentd.conf and added new line SubAgent=ssh.nsm, then restarted the agent.
2) On the server node I opened 'Data Collection Configuration' and there created new parameter.
Parameter: SSH.Command(192.168.10.1,admin,mypass,ls)
Origin: NetXMS Agent  Data Type: String
Source Node: myserver

Then I go into Object Details of the Node(myserver) and tab 'Last Values'.
Here I see the my parameter, but value is <<ERROR>> , Timestamp is empty.

thank You for any hint

Victor Kirhenshtein

You do not need source node if you have configured it on NetXMS server node. It defines where actual data collection will happen, in case of "agent" origin - what agent will be queried. You'll need source node to be set in the opposite case - when you configure DCI on "myserver" node but SSH subagent is on NetXMS server - then you'll have to set source node to NetXMS server node.

Best regards,
Victor

ZAJDAN

#4
the myserver in my case means the NetXMS server itself.
So I deleted the source node on the parameter, but it doesnt soved it.


Filipp Sudanov

The could be an issue that first SSH.Command since agent start is failing (https://track.radensolutions.com/issue/NX-1852), but is should start working when polled again.

ZAJDAN

#6
for sure I restarted the agnetd a checked his status:
~# systemctl status nxagentd
● nxagentd.service - NetXMS Agent
   Loaded: loaded (/lib/systemd/system/nxagentd.service; disabled; vendor preset
   Active: active (running) since Fri 2020-05-08 13:25:58 CEST; 7min ago
  Process: 1658 ExecStart=/usr/bin/nxagentd -d (code=exited, status=0/SUCCESS)
Main PID: 1659 (nxagentd)
    Tasks: 19 (limit: 3480)
   Memory: 13.9M
   CGroup: /system.slice/nxagentd.service
           └─1659 /usr/bin/nxagentd -d

May 08 13:25:55 info21-srv-monitor systemd[1]: Starting NetXMS Agent...
May 08 13:25:55 info21-srv-monitor systemd[1]: nxagentd.service: Can't open PID
May 08 13:25:58 info21-srv-monitor systemd[1]: Started NetXMS Agent.


Configuration Poll (Full)
08.05.2020 13:26:12] **** Poll request sent to server ****
[08.05.2020 13:26:25]    Checking EtherNet/IP...
[08.05.2020 13:26:25]    Cannot get device identity via EtherNet/IP (CONNECT FAILED)
[08.05.2020 13:26:25] Capability check finished
[08.05.2020 13:26:25] Checking interface configuration...
[08.05.2020 13:26:25] Interface configuration check finished
[08.05.2020 13:26:25] Checking node name
[08.05.2020 13:26:25] Node name is OK
[08.05.2020 13:26:25] Updating general system hardware information
[08.05.2020 13:26:25] Finished configuration poll for node info21-srv-monitor
[08.05.2020 13:26:25] Node configuration was not changed after poll
[08.05.2020 13:26:25] **** Poll completed successfully ****


but it doesn´t seems to be, that it helped :(

Filipp Sudanov

Ok, can set DebugLevel=7 in agent configuration file and show an extract from agent log file when the SSH command is executed.

Also, you can use nxget command - it requests data from the agent, e.g.:
nxget 127.0.0.1 "SSH.Command(host,user,password,ls)"

ZAJDAN

#8
ok ...
1) I have added the log level
2) Then I restarted the agent
3) Then I restarted the pool on the server
4) Jumped into the log a here it is:

2020.05.08 14:34:30.615 *D* [                   ] Event sender thread started
2020.05.08 14:34:31.616 *I* [                   ] NetXMS Agent started
2020.05.08 14:35:23.876 *D* [                   ] Incoming connection from 10.6.6.17
2020.05.08 14:35:23.876 *D* [                   ] Connection from 10.6.6.17 rejected
2020.05.08 14:35:30.615 *D* [dc                 ] DataCollector: sleeping for 60 seconds

10.6.6.17 is the NetXMS server self
so I again opened the nxagentd.conf and I have put there:

MasterServers=127.0.0.0/8,10.6.6.17
before was just:
MasterServers=127.0.0.0/8


and problem is SOLVED! super Thank You :_)