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. No output from ExternalParameterShellExec

No output from ExternalParameterShellExec

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

    I am trying to get CPU usage of a process on Microsoft Windows Server 2008 R2 using dos script. When I run dos script I am getting value. But on NetXMS server I am getting blank value. My dos script  is as following :-

    @echo off
    wmic path Win32_PerfFormattedData_PerfProc_Process get Name,PercentProcessorTime | findstr /i /c:w3wp >%temp%\cpu.txt
    set /p cph=<%temp%\cpu.txt
    for /f "delims=" %%2 in (%temp%\cpu.txt) do set CpuUsage=%%2
    set CpuUsage=%CpuUsage:w3wp=%
    set CpuUsage=%CpuUsage: =%
    rem set "%~1=%CpuUsage%"
    echo %CpuUsage%

    When I run this dos script from command prompt I get following value :-
    30

    I have configured ExternalParameterShellExecin on agent configuration file as following :-

    #
    # NetXMS agent configuration file
    # Created by agent installer at Sat May 20 17:52:36 2017
    #

    MasterServers = netxms.kochartech.com
    ConfigIncludeDir = C:\NetXMS\etc\nxagentd.conf.d
    LogFile = C:\NetXMS\Log.txt
    DebugLevel = 9
    AgentCommandTimeout = 40000
    FileStore = C:\NetXMS\var
    SubAgent = ecs.nsm
    SubAgent = filemgr.nsm
    SubAgent = ping.nsm
    SubAgent = logwatch.nsm
    SubAgent = portcheck.nsm
    SubAgent = winperf.nsm
    SubAgent = wmi.nsm
    ExternalParameterShellExec=w3wpcpu:C:\NetXMS\scripts\CpuUsage.cmd

    I have restarted the agent. Run Poll full configuration on Node from server console.
    When I run following command from server I got blank value
    c:\NetXMS\bin>nxget X.X.X.X w3wpcpu

    On agent debug log file I got this

    [15-Jun-2017 20:57:54.262] [DEBUG] [session:1] Received message CMD_GET_PARAMETER
    [15-Jun-2017 20:57:54.262] [DEBUG] [session:1] Requesting parameter "w3wpcpu"
    [15-Jun-2017 20:57:54.262] [DEBUG] H_ExternalParameter called for "w3wpcpu" "SC:\NetXMS\scripts\CpuUsage.cmd"
    [15-Jun-2017 20:57:54.262] [DEBUG] RunExternal called for "w3wpcpu" "SC:\NetXMS\scripts\CpuUsage.cmd"
    [15-Jun-2017 20:57:54.262] [DEBUG] RunExternal: command line is "C:\NetXMS\scripts\CpuUsage.cmd"
    [15-Jun-2017 20:57:54.262] [DEBUG] RunExternal (shell exec): worker thread created
    [15-Jun-2017 20:57:54.730] [DEBUG] RunExternal (shell exec): execution status 0
    [15-Jun-2017 20:57:54.730] [DEBUG] [session:1] GetParameterValue(): result is 0 (SUCCESS)
    [15-Jun-2017 20:57:54.730] [DEBUG] [session:1] Sending message CMD_REQUEST_COMPLETED (size 48)
    [15-Jun-2017 20:57:54.730] [DEBUG] [session:1] Outgoing message dump:
      ** 001D0000000000300000000200000002
      ** 0000001C000000000000000000000000
      ** 00000015010000000000000000000000
      ** code=0x001D (CMD_REQUEST_COMPLETED) flags=0x0000 id=2 size=48 numFields=2
      ** [    28] INT32    0
      ** [    21] STRING  ""

    [15-Jun-2017 20:57:54.746] [DEBUG] [session:1] Message receiving error (MSGRECV_CLOSED)
    [15-Jun-2017 20:57:54.746] [DEBUG] [session:1] Session with X.X.X.X closed
    [15-Jun-2017 20:57:55.448] [DEBUG] [session:0] Message dump:
      ** 00410000000000300000003700000001
      ** 00000055010000000000000E00770033
      ** 00770070006300700075000000000000
      ** code=0x0041 (CMD_GET_PARAMETER) flags=0x0000 id=55 size=48 numFields=1
      ** [    85] STRING  "w3wpcpu"

    [15-Jun-2017 20:57:55.448] [DEBUG] [session:0] Received message CMD_GET_PARAMETER
    [15-Jun-2017 20:57:55.448] [DEBUG] [session:0] Requesting parameter "w3wpcpu"
    [15-Jun-2017 20:57:55.448] [DEBUG] H_ExternalParameter called for "w3wpcpu" "SC:\NetXMS\scripts\CpuUsage.cmd"
    [15-Jun-2017 20:57:55.448] [DEBUG] RunExternal called for "w3wpcpu" "SC:\NetXMS\scripts\CpuUsage.cmd"
    [15-Jun-2017 20:57:55.448] [DEBUG] RunExternal: command line is "C:\NetXMS\scripts\CpuUsage.cmd"
    [15-Jun-2017 20:57:55.448] [DEBUG] RunExternal (shell exec): worker thread created
    [15-Jun-2017 20:57:55.900] [DEBUG] RunExternal (shell exec): execution status 0
    [15-Jun-2017 20:57:55.900] [DEBUG] [session:0] GetParameterValue(): result is 0 (SUCCESS)
    [15-Jun-2017 20:57:55.900] [DEBUG] [session:0] Sending message CMD_REQUEST_COMPLETED (size 48)
    [15-Jun-2017 20:57:55.900] [DEBUG] [session:0] Outgoing message dump:
      ** 001D0008000000300000003700000002
      ** 0000001C000000000000000000000000
      ** 00000015010000000000000000000000
      ** code=0x001D (CMD_REQUEST_COMPLETED) flags=0x0008 id=55 size=48 numFields=2
      ** [    28] INT32    0
      ** [    21] STRING  ""

    Kindly help how to resolve the issue and get value on server.

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

      Hi!

      Agent usually runs under local system account. Are you sure that your script will work correctly under local system?

      Best regards,
      Victor

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

        Hi,

        Yes, script is working under local system account. It is writing output to txt file. I have tried vb-script to get desired results, VB script is working fine and I am able to get results from ExternalParamaterShellExec.  But DOS script is not giving any results.

        Regards,
        Vijay.

        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