Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-22878

zabbix_agent2 can't run scripts in UserParameter

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Cannot Reproduce
    • Icon: Trivial Trivial
    • None
    • 6.4.2, 6.4.3
    • Agent (G)
    • None

      After update agent from version 6.2.6 to 6.4.2 userparameters don't work at all on Windows Server 2019 and 2022

      Steps to reproduce:

      1. zabbix_agent2.conf:
        Include=C:\zabbix_userparameters\*.conf

        mail_queue.conf in C:\zabbix_userparameters\ directory :

        UserParameter=mail.queue,powershell.exe -NoProfile -ExecutionPolicy Bypass -file "C:\zabbix_userparameters\scripts\mail_queue.ps1"
        UserParameter=mail.test1,powershell.exe -NoProfile -ExecutionPolicy Bypass -command "Write-Host ([System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite().Name)"
        UserParameter=mail.test2,echo test2
        
      1. Testing keys
        .\zabbix_get.exe -s localhost -k mail.queue
        .\zabbix_get.exe -s localhost -k mail.test1
        .\zabbix_get.exe -s localhost -k mail.test2
      1. Tried to set UserParameterDir to C:\Windows\System32, it works the same

      Result:
      Output:

      PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.queue
      ZBX_NOTSUPPORTED: Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory
      
      PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test1
      ZBX_NOTSUPPORTED: Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory
      
      PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test2
      ZBX_NOTSUPPORTED: Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory

      Log file:

      2023/05/31 16:17:55.702025 received passive check request: 'mail.queue' from '10.*.*.*'
      2023/05/31 16:17:55.702602 [1] adding new request for key: 'mail.queue'
      2023/05/31 16:17:55.703195 [1] created direct exporter task for plugin 'UserParameter' itemid:0 key 'mail.queue'
      2023/05/31 16:17:55.703782 executing direct exporter task for key 'mail.queue'
      2023/05/31 16:17:55.704358 [UserParameter] executing command:'powershell.exe -NoProfile -ExecutionPolicy Bypass -file "C:\zabbix_userparameters\scripts\mail_queue.ps1"'
      2023/05/31 16:17:55.707300 failed to execute direct exporter task for key 'mail.queue' error: 'Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory'
      2023/05/31 16:17:55.707829 sending passive check response: ZBX_NOTSUPPORTED: 'Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory' to '10.*.*.*' 

      Zabbix Web says the same after trying to test value:

      Cannot find path to cmd.exe command: exec: "cmd.exe": cannot run executable found relative to current directory

      Expected:

      PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.queue 
      int number
      
      PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test1
      string
      
      PS C:\Program Files\zabbix_agent2\bin> .\zabbix_get.exe -s localhost -k mail.test2 test2

       

       

            mbuz Maksym Buz
            Antimodest Valerii Denysenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: