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. External Parameter fail for agent daemon mode

External Parameter fail for agent daemon mode

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 13.1k 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.
  • X
    X
    xatteg
    wrote on last edited by
    #1

    Hi All,

    I'm using external parameters in nxagentd.conf file, one of them:

    ExternalParameter = CF2PRIVATEMEM:privatemem.sh

    If I launch nxagentd -f -D 9  it executes and reads the parameter correctly

    [12-Aug-2016 14:30:59.404] [DEBUG] [session:0] Received message CMD_GET_PARAMETER
    [12-Aug-2016 14:30:59.404] [DEBUG] [session:0] Requesting parameter "CF2PRIVATEMEM"
    [12-Aug-2016 14:30:59.404] [DEBUG] H_ExternalParameter called for "CF2PRIVATEMEM" "Eprivatemem.sh"
    [12-Aug-2016 14:30:59.404] [DEBUG] RunExternal called for "CF2PRIVATEMEM" "Eprivatemem.sh"
    [12-Aug-2016 14:30:59.404] [DEBUG] RunExternal: command line is "privatemem.sh"
    [12-Aug-2016 14:30:59.405] [DEBUG] RunExternal (shell exec): worker thread created
    [12-Aug-2016 14:30:59.502] [DEBUG] H_ExternalParameter/POpenWorker: worker thread pipe read result: 0x7f8e8f5a5d70
    [12-Aug-2016 14:30:59.503] [DEBUG] RunExternal (shell exec): execution status 0
    [12-Aug-2016 14:30:59.503] [DEBUG] [session:0] GetParameterValue(): result is 0 (SUCCESS)
    [12-Aug-2016 14:30:59.503] [DEBUG] [session:0] Sending message CMD_REQUEST_COMPLETED (size 56)
    [12-Aug-2016 14:30:59.503] [DEBUG] [session:0] Outgoing message dump:
      ** 001D0000000000380000001800000002
      ** 0000001C000000000000000000000000
      ** 00000015010000000000000C00340037
      ** 0037003300310032
      ** code=0x001D (CMD_REQUEST_COMPLETED) flags=0x0000 id=24 size=56 numFields=2
      ** [    28] INT32    0
      ** [    21] STRING  "477312"

    However if I launch in daemon mode nxagentd -d -D 9  then I get the following

    [12-Aug-2016 14:29:31.930] [DEBUG] [session:0] Received message CMD_GET_PARAMETER
    [12-Aug-2016 14:29:31.930] [DEBUG] [session:0] Requesting parameter "CF2PRIVATEMEM"
    [12-Aug-2016 14:29:31.930] [DEBUG] H_ExternalParameter called for "CF2PRIVATEMEM" "Eprivatemem.sh"
    [12-Aug-2016 14:29:31.930] [DEBUG] RunExternal called for "CF2PRIVATEMEM" "Eprivatemem.sh"
    [12-Aug-2016 14:29:31.930] [DEBUG] RunExternal: command line is "privatemem.sh"
    [12-Aug-2016 14:29:31.930] [DEBUG] RunExternal (shell exec): worker thread created
    [12-Aug-2016 14:29:31.936] [DEBUG] RunExternal (shell exec): execution status 0
    [12-Aug-2016 14:29:31.936] [DEBUG] [session:0] GetParameterValue(): result is 0 (SUCCESS)
    [12-Aug-2016 14:29:31.936] [DEBUG] [session:0] Sending message CMD_REQUEST_COMPLETED (size 48)
    [12-Aug-2016 14:29:31.936] [DEBUG] [session:0] Outgoing message dump:
      ** 001D0000000000300000001900000002
      ** 0000001C000000000000000000000000
      ** 00000015010000000000000000000000
      ** code=0x001D (CMD_REQUEST_COMPLETED) flags=0x0000 id=25 size=48 numFields=2
      ** [    28] INT32    0
      ** [    21] STRING  ""

    Which is wrong. Current version of server and agent is 2.0.5 and it does not work here.
    When I had version 1.2.17 it worked correctly.

    1 Reply Last reply
    0
    • X
      X
      xatteg
      wrote on last edited by
      #2

      I figured out that agent in daemon mode reacts with pain on sudo command in external script.
      E.g. if script contain something

      #!/bin/bash
      echo 300

      Than it works, but if we add sudo

      sudo -u someuser echo 300

      It does not. Did anyone run into this?

      1 Reply Last reply
      0
      • A
        A
        Alex Kirhenshtein
        wrote on last edited by
        #3

        Try to remove "Defaults requiretty" from /etc/sudoers

        1 Reply Last reply
        0
        • X
          X
          xatteg
          wrote on last edited by
          #4

          This worked!

          Many thanks!

          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