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. Getting value from ExternalParameter / ExternalMetric not working after update

Getting value from ExternalParameter / ExternalMetric not working after update

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 8.5k 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.
  • S
    S
    stoffmann
    wrote on last edited by
    #1

    Hi,
    I updated our NetXMS installation from 4.2 to 4.4.5 today and have a problem with getting values from ExternalParameter.

    I used the following line in 4.2 to get the value of a registry key:

    ExternalParameter=RegQuery.EBTransfer720:"D:\Program Files\NetXMSAgent\custom\CheckRegKey\CheckRegKey.exe" "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files" "ImageFilePath"
    

    After update the showed the following in value:
    'D:\Program' is not recognized as an internal or external command

    After some reading I found that  ExternalParameter is replaced by ExternalMetric,
    so I tried:

    ExternalMetric=RegQuery.EBTransfer720:"D:\Program Files\NetXMS\custom\CheckRegKey\CheckRegKey.exe" "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files" "ImageFilePath"
    

    But the result us the same:  'D:\Program' is not recognized as an internal or external command

    Any idea what could be the reason?

    Regards

    Stefan

    1 Reply Last reply
    0
    • S
      S
      stoffmann
      wrote on last edited by
      #2

      I checked the agent log and after invreasing the debug level to 7; found thi. Maybe it can help identify the reason:

      2023.12.13 13:02:47.458 *D* [comm.cs.1          ] Requesting metric "RegQuery.EBTransfer720"
      2023.12.13 13:02:47.458 *D* [comm.cs.1          ] H_ExternalMetric called for "RegQuery.EBTransfer720" ""D:\Program Files\NetXMSAgent\custom\CheckRegKey\CheckRegKey.exe" "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files" "ImageFilePath""
      2023.12.13 13:02:47.458 *D* [exec              ] RunExternal called for "RegQuery.EBTransfer720" ""D:\Program Files\NetXMSAgent\custom\CheckRegKey\CheckRegKey.exe" "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files" "ImageFilePath""
      2023.12.13 13:02:47.458 *D* [exec              ] RunExternal: command line is ""D:\Program Files\NetXMSAgent\custom\CheckRegKey\CheckRegKey.exe" "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files" "ImageFilePath""
      2023.12.13 13:02:47.473 *D* [procexec.13        ] ProcessExecutor::executeWithOutput(): process "CMD.EXE /C "D:\Program Files\NetXMSAgent\custom\CheckRegKey\CheckRegKey.exe" "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files" "ImageFilePath"" started (PID=14800)
      2023.12.13 13:02:47.739 *D* [procexec.13        ] ProcessExecutor::readOutput(): stopped on GetOverlappedResult (The pipe has been ended.)
      2023.12.13 13:02:47.739 *D* [procexec.13        ] ProcessExecutor::stop(): cannot terminate process (Access is denied.)
      2023.12.13 13:02:47.739 *D* [comm.cs.1          ] GetMetricValue("RegQuery.EBTransfer720"): 0 (SUCCESS) value = "'D:\Program' is not recognized as an internal or external command,"
      2023.12.13 13:02:47.739 *D* [comm.cs.1          ] Sending message CMD_REQUEST_COMPLETED (ID 3839; size 112; uncompressed)
      

      To me it looks like Net XMS is adding a CMD.EXE /C before my command, witch I don't understand. Shoudn't this be only the case if I use ExternalMetricShellExec?

      1 Reply Last reply
      0
      • F
        F
        Filipp Sudanov
        wrote on last edited by
        #3

        The problem is that single quotes are get lost somewhere during all this process. You can specify using "" which will be escaped to " in the end, e.g.:

        ExternalMetric=RegQuery.EBTransfer720:""D:\Program
         Files\NetXMS\custom\CheckRegKey\CheckRegKey.exe""
        "HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files"
        "ImageFilePath"
        

        But better way is to use new (and not yet documented) docker-style syntax:

        ExternalMetric=RegQuery.EBTransfer720:['D:\Program
         Files\NetXMS\custom\CheckRegKey\CheckRegKey.exe',
        'HKLM\SOFTWARE\WOW6432Node\Aucotec\Engineering Base\7.2.0\Server\Files',
        'ImageFilePath']
        

        currently that works with single quotes (') only, but in next patch release double quotes (") will also be supported.

        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