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

Powershell script run via system.run in Agent 2 not executing correctly

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • None
    • None

      Executing a system.run command as shown in the example below does not execute correctly when nowait parameter is set.

      Removing the nowait parameter allows the script to execute correctly.

      Steps to reproduce:

      Create passive check, key "system.run["powershell.exe -executionpolicy bypass -File \"C:\Program Files\Zabbix Agent 2\Scripts\Get-PendingReboot.ps1\" check",nowait]"

      Execute check either via "Execute" or using zabbix_get

      Confirm that command was received and excuted on Agent 2 (DebugLevel=4)

      2021/04/23 12:23:34.796755 received passive check request: 'system.run[powershell.exe -executionpolicy bypass -File "C:\Program Files\Zabbix Agent 2\Scripts\Get-WindowsUpdateLastInstalled.ps1" check,nowait]' from '192.168.10.100'
      2021/04/23 12:23:34.797732 [1] processing update request (1 requests)
      2021/04/23 12:23:34.797732 [1] adding new request for key: 'system.run[powershell.exe -executionpolicy bypass -File "C:\Program Files\Zabbix Agent 2\Scripts\Get-WindowsUpdateLastInstalled.ps1" check,nowait]'
      2021/04/23 12:23:34.798731 [1] created direct exporter task for plugin 'SystemRun' itemid:0 key 'system.run[powershell.exe -executionpolicy bypass -File "C:\Program Files\Zabbix Agent 2\Scripts\Get-WindowsUpdateLastInstalled.ps1" check,nowait]'
      2021/04/23 12:23:34.798731 executing direct exporter task for key 'system.run[powershell.exe -executionpolicy bypass -File "C:\Program Files\Zabbix Agent 2\Scripts\Get-WindowsUpdateLastInstalled.ps1" check,nowait]'
      2021/04/23 12:23:34.799731 [SystemRun] Executing command:'powershell.exe -executionpolicy bypass -File "C:\Program Files\Zabbix Agent 2\Scripts\Get-WindowsUpdateLastInstalled.ps1" check'
      2021/04/23 12:23:34.808731 executed direct exporter task for key 'system.run[powershell.exe -executionpolicy bypass -File "C:\Program Files\Zabbix Agent 2\Scripts\Get-WindowsUpdateLastInstalled.ps1" check,nowait]'
      2021/04/23 12:23:34.812733 sending passive check response: '1' to '192.168.10.100'

      Expected output should be zabbix_sender called to send back a value (and output to a log file at each function/step to show that script has been run).

      No file is created

      Expected

      A system.run item with a nowait command should work as expected.

        1. image-2021-04-23-12-21-48-693.png
          12 kB
          Shane Arnold
        2. image-2021-04-23-12-23-52-839.png
          11 kB
          Shane Arnold
        3. image-2021-04-23-12-26-41-260.png
          5 kB
          Shane Arnold
        4. image-2021-04-23-12-29-43-397.png
          3 kB
          Shane Arnold
        5. image-2021-04-23-12-38-15-204.png
          13 kB
          Shane Arnold
        6. image-2021-04-23-13-15-58-443.png
          25 kB
          Shane Arnold

            zabbix.support Zabbix Support Team
            clontarfx@gmail.com Shane Arnold
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: