Execute command on remote node via agent

Started by tholle, April 18, 2016, 09:39:04 PM

Previous topic - Next topic

tholle

Hi,

And thanks for a great product .. it has resolved a lot of problems for us :-)

but ... i can't get remote script working on event..

I made a action on the agent ... nxagentd.conf
EnableActions=yes
Action=script1:/bin/ls -l > /tmp/script1.txt && echo 1

And in Configuration->Actions Configuration ->
Name : agentscript1
type : Execute command on remote node via agent
Remote host : %a
Agent's action: script1

when i add a Event processing Policy before the "Generate alarm on threshold violation" as a copy of that .. remove the "create new" to "Do not change alarms" .. and add "Server Acrions" -> Action = agentscript1 ...

when i stress the agent pc i can se the agent log receive the action request fine ..


Connection from 192.168.1.29 accepted
[18-Apr-2016 22:17:46.975] [DEBUG] [session:1] Received control message CMD_GET_NXCP_CAPS
[18-Apr-2016 22:17:46.975] [DEBUG] [session:1] Sending message CMD_NXCP_CAPS (size 16)
[18-Apr-2016 22:17:46.986] [DEBUG] [session:1] Received message CMD_SET_SERVER_CAPABILITIES
[18-Apr-2016 22:17:46.986] [DEBUG] [session:1] Sending message CMD_REQUEST_COMPLETED (size 32)
[18-Apr-2016 22:17:46.997] [DEBUG] [session:1] Received message CMD_ACTION
[18-Apr-2016 22:17:46.997] [DEBUG] Executing action script1 of type 1
[18-Apr-2016 22:17:46.997] [DEBUG] EXEC: Expanding command "/bin/ls -l > /tmp/script1.txt && echo 1"
[18-Apr-2016 22:17:46.997] [DEBUG] EXEC: Executing "/bin/ls -l > /tmp/script1.txt && echo 1"
[18-Apr-2016 22:17:47.008] [DEBUG] [session:1] Sending message CMD_REQUEST_COMPLETED (size 32)
[18-Apr-2016 22:17:47.019] [DEBUG] [session:1] Message receiving error (MSGRECV_CLOSED)
[18-Apr-2016 22:17:47.019] [DEBUG] [session:1] Session with 192.168.1.29 closed
[18-Apr-2016 22:17:56.961] [DEBUG] [session:0] Received message CMD_GET_PARAMETER
[18-Apr-2016 22:17:56.961] [DEBUG] [session:0] Requesting parameter "System.CPU.LoadAvg"
[18-Apr-2016 22:17:56.961] [DEBUG] [session:0] Sending message CMD_REQUEST_COMPLETED (size 64)

but nothing happend !! .. no /tmp/script1.txt files ...

i had try to add the actions in "Object tools" and i works fine there ..

any help ??







tholle

ups ... i use ver 2.03 on centos servers .. both on netxms server and agent server :-)

Victor Kirhenshtein

Hi,

try to use ActionShellExec instead of Action in nxagentd.conf.

Best regards,
Victor

tholle


Bingo ... it works ... thanks a lot ..

sometimes .. when you get the answar .. the question look so silly :-)