[SOLVED] ActionShellExec Confusion...
-
I am trying to do a simple update of node status into a MS-SQL server when the status on a node changes. I have written a really simply .cmd file to handle passing in the hostname, ip address, status and comment. Can run this from the command prompt on the server and it works as expected.
On the server running the agent we have the following:
ActionShellExec = Sql.StatusUpdate:D:\nodeUpdate.cmd $1 $2 $3 $4If I enable debugging on the agent can see this is getting fired off:
2022.02.18 13:06:23.802 *D* [comm.cs.232 ] Received message CMD_ACTION (4) 2022.02.18 13:06:23.811 *D* [procexec ] ProcessExecutor::execute(): process "CMD.EXE /C D:\nodeUpdate.cmd host.com 1.2.3.4 down Yikes" started 2022.02.18 13:06:23.812 *D* [actions ] Execution of external action Sql.StatusUpdate (D:\nodeUpdate.cmd host.com 1.2.3.4 down Yikes) started 2022.02.18 13:06:23.812 *D* [actions ] ExecuteAction(Sql.StatusUpdate): requestId=4, RCC=0 2022.02.18 13:06:23.812 *D* [comm.cs.232 ] Sending message CMD_REQUEST_COMPLETED (ID 4; size 32; uncompressed)One of the first thing the script does is echo the parameters to a temporary file, so we have some history. That is never getting triggered and definitely the sqlcmd statement in the script is not running. Have been pulling my hair out for a while and cannot figure out why this is not working.
Ideally, though at this point becoming less of a bid deal that last parameter should allow for a string with spaces. That at this point is icing on the cake, just want it working.
Thoughts?
-
Following up on my own post, but still hoping for some clarity. This fails running AgentExecuteAction on the node, but works if I run nxaction from the server command line. The exact calls are as follows:
Does not work:
AgentExecuteAction($node, "Sql.StatusUpdate","host.com","1.2.3.4","down","YIKES");
Works:
nxaction -s NOTTREALKEYHERE -o sql.host.com "Sql.StatusUpdate" "host.com" "1.2.3.4" "down" "YIKES"Maybe AgentExecuteAction does not handle shared secrets properly?
-
Hi,
what server version you are using? Also, try to set debug level to 5 on server and check server log for lines starting with NXSL: F_AgentExecuteAction.
Best regards,
Victor -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login