Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. [SOLVED] ActionShellExec Confusion...

[SOLVED] ActionShellExec Confusion...

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 34.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L
    L
    lweidig
    wrote on last edited by
    #1

    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 $4
    

    If 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?

    1 Reply Last reply
    0
    • L
      L
      lweidig
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • V
        V
        Victor Kirhenshtein
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • L
          L
          lweidig
          wrote on last edited by
          #4

          The previous posts were all running in 3.9.xxx (I believe 420).  We have upgraded now to 4.0.2157 and we are not having issues any longer with this.

          1 Reply Last reply
          0

          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
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups