Ad Widget

Collapse

SQL error - Heterogeneous queries error with zabbix Database monitor item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • registration_is_lame
    Senior Member
    • Nov 2007
    • 148

    #1

    SQL error - Heterogeneous queries error with zabbix Database monitor item

    Item type: Database Monitor

    There seems to be no way to `SET ANSI_WARNINGS ON` and `SET ANSI_NULLS ON` in the query section to disable the error. At least isn't working. Is there any other way to set it?

    Item Error: Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection.

    I tried
    Code:
    SET ANSI_WARNINGS ON; SET ANSI_NULLS ON; select * ...
    before the select statement and it did not work. I also tried [CODE}GO SET ANSI_WARNINGS ON; ANSI_NULLS ON; select * ... GO[/CODE] but that did not work either - zabbix reported syntax error.

    Any suggestions on how to resolve this?


    Here is my Query:

    Code:
        select sum(item_count) from (select  
        coalesce(c.cnt, 0) as [item_count] 
    
    
        from LINKED_DB_USER.[UserDB].[dbo].[User] as us LEFT JOIN LINKED_DB_USER.[USerDB].[dbo].[Account] as cs ON us.[user_id] = cs.[user_id]  
    
        FULL OUTER JOIN 
        (
         select [Account_ID], count(*) as cnt
        from [OnlineUSers].[dbo].[USER_NAME] where USER_ID in (select USER_ID from [OnlineUsers].[dbo].[Last_Login])
        group by [Account_ID]
        )  c on c.[Account_ID] = us.[Unique_ID] where cs.name = 'SOME_NAME') src;
  • registration_is_lame
    Senior Member
    • Nov 2007
    • 148

    #2
    It seems command `SET ...` isn't supported by ODBC driver.

    Solution is to use Stored Procedure with `SET ...` and then call the Stored Procedure from Zabbix ITEM query.

    Comment

    Working...