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

Windows Service management signals not properly handled in Zabbix Agent 2

XMLWordPrintable

    • Sprint 73 (Feb 2021), Sprint 74 (Mar 2021), Sprint 75 (Apr 2021), Sprint 76 (May 2021)
    • 1

      In the case the Zabbix 2 Agent receives Windows service management signals other than svc.Stop and svc.Shutdown this is poorly handled by logging ambiguous "unsupported windows service command recieved" message (https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/go/cmd/zabbix_agent2/service_windows.go?until=ce3e8eb5eae1bf209cd3ca23795a69a15f48f68f&untilPath=src%2Fgo%2Fcmd%2Fzabbix_agent2%2Fservice_windows.go#461).

      This can be reproduced from the PowerShell for example by issuing commands like:

      Windows PowerShell
      Copyright (C) 2016 Microsoft Corporation. All rights reserved.
      PS C:\Users\Administrator> Suspend-Service -DisplayName "Zabbix Agent 2"
      Suspend-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be suspended because the service does not support be
      ing suspended or resumed.
      At line:1 char:1
      + Suspend-Service -DisplayName "Zabbix Agent 2"
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Suspend-Service
       ], ServiceCommandException
       + FullyQualifiedErrorId : CouldNotSuspendServiceNotSupported,Microsoft.PowerShell.Commands.SuspendServiceCommand
      Suspend-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be suspended due to the following error: Cannot paus
      e Zabbix Agent 2 service on computer '.'.
      At line:1 char:1
      + Suspend-Service -DisplayName "Zabbix Agent 2"
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Suspend-Service
       ], ServiceCommandException
       + FullyQualifiedErrorId : CouldNotSuspendService,Microsoft.PowerShell.Commands.SuspendServiceCommand
      

      or 

      PS C:\Users\Administrator> Start-Service -DisplayName "Zabbix Agent 2"
      PS C:\Users\Administrator> Resume-Service -DisplayName "Zabbix Agent 2"
      Resume-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be resumed because the service does not support being suspended or resumed.
      At line:1 char:1
      + Resume-Service -DisplayName "Zabbix Agent 2"
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Resume-Service], ServiceCommandException
       + FullyQualifiedErrorId : CouldNotResumeServiceNotSupported,Microsoft.PowerShell.Commands.ResumeServiceCommand
      Resume-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be resumed due to the following error: Cannot resume Zabbix Agent 2 service on computer '.'.
      At line:1 char:1
      + Resume-Service -DisplayName "Zabbix Agent 2"
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Resume-Service], ServiceCommandException
       + FullyQualifiedErrorId : CouldNotResumeService,Microsoft.PowerShell.Commands.ResumeServiceCommand
       

       
      This is accordingly seen in the agent log:

      2021/02/26 14:31:18.413739 unsupported windows service command 

       
      Below is the link to some example Go code demonstrating how to handle the commands (they may vary, e. g., svc.Interrogate, svc.Pause, svc.Continue):

      https://github.com/golang/sys/blob/a50acf3fe073/windows/svc/example/service.go#L30

      AFAICS, all versions starting from the implementation of Windows services support are affected.

            esneiders Eriks Sneiders
            ssimonenko Sergey Simonenko (Inactive)
            Team INT
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: