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

Database monitor items failing while the same working fine with ODBC usage


    • Icon: Problem report Problem report
    • Resolution: Workaround proposed
    • Icon: Major Major
    • 6.4 (plan)
    • 4.0.33, 5.0.15, 5.4.4
    • Proxy (P), Server (S)
    • None
    • Zabbix
      Microsoft SQL Server 2012
    • Sprint 92 (Sep 2022)
    • 1

      Steps to reproduce:

      1. Create a basic MSSQL instance
      2. Configure ODBC connection
      3. Connect to MSSQL Instance with isql
      4. Run the query
      SQL> DECLARE @strsql NVARCHAR(max) SET @strsql = 'if exists (select name from sys.databases where name=''dba_ops'') begin if exists (select 1 from dba_ops.sys.tables where name = ''dbm_rebuild_reorg_history'') begin if exists (select top 1 reindex_type from dba_ops.dbo.dbm_rebuild_reorg_history where entry_timestamp >= DATEADD(day, -3, GetDate())) begin select 0 as condition end else begin if exists (select 1 from dba_ops.dbo.dbm_gather_frag_details where scan_date >= DATEADD(day, -3, GetDate()) and fragmentation > 20 and page_count >10) begin Select 1 as condition end else Begin Select 0 as condition end end end else begin Select 0 as condition end end else begin Select 0 as condition end' BEGIN TRY IF (SELECT SERVERPROPERTY('IsHadrEnabled')) = 1 BEGIN IF NOT EXISTS ( SELECT 1 FROM sys.availability_groups_cluster AS AGC LEFT JOIN sys.dm_hadr_availability_replica_cluster_states AS RCS ON RCS.group_id = AGC.group_id LEFT JOIN sys.dm_hadr_availability_replica_states AS ARS ON ARS.replica_id = RCS.replica_id LEFT JOIN sys.availability_group_listeners AS AGL ON AGL.group_id = ARS.group_id WHERE RCS.replica_server_name = @@SERVERNAME AND ARS.role_desc = 'SECONDARY') BEGIN EXEC sp_executesql @strsql END ELSE BEGIN Select 0 as condition END END ELSE BEGIN EXEC sp_executesql @strsql END END TRY BEGIN CATCH Select 1 as condition END CATCH;
      | condition  |
      | 0          |

      All working fine

        5. Create an item with database monitor type
        6. Try to test it or wait for new data in Zabbix before 5.0
      Empty result


      Query working fine

            vso Vladislavs Sokurenko
            igorbach Igor Gorbach
            Team A
            2 Vote for this issue
            7 Start watching this issue