Ad Widget

Collapse

Long system.run command returns Unknow metric, short one works fine

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #1

    Long system.run command returns Unknow metric, short one works fine

    Hi,

    I got an agent2 6.4.8 with same version server.
    And I noticed the following.
    In the agent2 conf: following parameters changed:
    Timeout=15

    AllowKey=system.run[powershell*]

    The timeout is needed because I have a powershell command which could take up to 6 / 7 secconds. (timeout is also changed on server to make it work)
    With the settings above the following works just fine
    Code:
    system.run[powershell.exe -c "write-output (New-Object -ComObject Microsoft.Update.AutoUpdate).Results | Select-object -expandproperty LastInstallationSuccessDate"]
    Code:
    system.run[powershell.exe -c "$UpdateSession = New-Object -ComObject Microsoft.Update.Session ; $UpdateSearcher = $UpdateSession.CreateupdateSearcher() ; $UpdateSearcher.Search('IsHidden=0 and IsInstalled=0').Updates | Select-Object -expandproperty Title", wait]
    doesn't work

    When i change the conf file to
    AllowKey=system.run[*]

    Both are working fine.
    Could it be that somehow the longer command is processed are more than 1 action?
    shortening the long command with smaller variable names (total command size change from 262 to 212 characters) doesn't change the result outcome
    Code:
     system.run[powershell.exe -c "$L = New-Object -ComObject Microsoft.Update.Session ; $K = $L.CreateupdateSearcher() ; $K.Search('IsHidden=0 and IsInstalled=0').Updates | Select-Object -expandproperty Title", wait]" became not supported: Unknown metric system.run
    Last edited by Brambo; 14-12-2023, 16:18.
  • Answer selected by Brambo at 15-12-2023, 11:29.
    LenR
    Senior Member
    • Sep 2009
    • 1005

    Try powershell*,*. I've had problems when the wait/nowait option wasn't specified.
    Last edited by LenR; 14-12-2023, 20:55. Reason: Spelled powershell wrong.

    Comment

    • LenR
      Senior Member
      • Sep 2009
      • 1005

      #2
      Try powershell*,*. I've had problems when the wait/nowait option wasn't specified.
      Last edited by LenR; 14-12-2023, 20:55. Reason: Spelled powershell wrong.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #3
        Originally posted by LenR
        Try powershell*,*. I've had problems when the wait/nowait option wasn't specified.
        This is mentioned under "Scripts" ..



        And another thing...

        Comment

        • Brambo
          Senior Member
          • Jul 2023
          • 245

          #4
          Ok that fixed it.
          Didn't expect it at the wait function as the documentation say, when not specified default nowait is done. But apparently there is a difference between sending nowait or default execution is nowait

          Comment

          Working...