NetXMS Support Forum

English Support => General Support => Topic started by: ZAJDAN on May 07, 2020, 06:11:04 PM

Title: monitoring space on remote HDD over SSH
Post by: ZAJDAN on May 07, 2020, 06:11:04 PM
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
Title: Re: monitoring space on remote HDD over SSH
Post by: Filipp Sudanov on May 07, 2020, 11:47:37 PM
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.
Title: Re: monitoring space on remote HDD over SSH
Post by: ZAJDAN on May 08, 2020, 12:59:15 AM
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
Title: Re: monitoring space on remote HDD over SSH
Post by: Victor Kirhenshtein on May 08, 2020, 10:17:56 AM
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
Title: Re: monitoring space on remote HDD over SSH
Post by: ZAJDAN on May 08, 2020, 10:26:31 AM
the myserver in my case means the NetXMS server itself.
So I deleted the source node on the parameter, but it doesnt soved it.
(https://pasteall.org/media/7/5/75441e222cb9d2586842d3220a62bbc6.png)
Title: Re: monitoring space on remote HDD over SSH
Post by: Filipp Sudanov on May 08, 2020, 02:05:28 PM
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.
Title: Re: monitoring space on remote HDD over SSH
Post by: ZAJDAN on May 08, 2020, 02:15:15 PM
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 :(
Title: Re: monitoring space on remote HDD over SSH
Post by: Filipp Sudanov on May 08, 2020, 03:33:04 PM
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)"
Title: Re: monitoring space on remote HDD over SSH
Post by: ZAJDAN on May 08, 2020, 03:38:42 PM
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 :_)