Hello,
I am trying to use the NXSL command "AgentExecuteAction".
In the configuration file of my agent, I have placed:
ExternalParameter = Test:echo test > /tmp/test.txt
This works very well on the command line:
/opt/netxms/bin/nxget localhost 'Test
# more /tmp/test.txt
test
So, I made a very small script ;):
AgentExecuteAction($node, "Test");
I execute it...
I can see the action in debug mode:
** code=0x0043 (CMD_ACTION) version=5 flags=0x0000 id=4 size=56 numFields=3
** 000000: [ 87] UTF8-STRING "Test"
** 000010: [ 482] INT16 0
** 000018: [ 88] INT32 0
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Received message CMD_ACTION (4)
2021.06.07 16:22:52.231 *D* [actions ] ExecuteAction(Test): requestId=4, RCC=404
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Sending message CMD_REQUEST_COMPLETED (ID 4; size 32; uncompressed)
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Outgoing message dump:
** 000000 | 00 1D 50 00 00 00 00 20 00 00 00 04 00 00 00 01 | ..P.... ........
** 000010 | 00 00 00 1C 00 00 00 00 00 00 01 94 00 00 00 00 | ................
** code=0x001D (CMD_REQUEST_COMPLETED) version=5 flags=0x0000 id=4 size=32 numFields=1
** 000000: [ 28] INT32 404
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Communication channel closed by peer
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Session with 129.20.128.4 closed
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Session unregistered
2021.06.07 16:22:52.231 *D* [comm.cs.4 ] Receiver thread stopped
but it doesn't work ...
Is it a syntax problem?
A Parameter problem?
Thanks
BB
There are two things that can be configured on agent:
- ExternalParameter (gets executed when server or nxget is requesting the value from agent. Or with AgentReadParameter() from NXSL)
- ExternalAction (gets executed by nxaction, server action (e.g. from EPP rule) or NXSL AgentExecuteAction
With AgentReadParameter it is perfect.
Thank you.
BB