Ad Widget

Collapse

SQL Query Item error: SQL Query returned empty result odbc database monitor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IvoWijnen
    Junior Member
    • Jul 2021
    • 2

    #1

    SQL Query Item error: SQL Query returned empty result odbc database monitor

    Hello Zabbix fanatics,

    I have an issue with configuring MS SQL database monitoring, I have installed the Microsoft odbc driver for sql server from the official Zabbix guide, have my dsn configured and when creating an item in Zabbix I got the error: "SQL Query returned empty result"

    I do not have my credentials of the sql account in the odbc.ini but in the macro's {$MSSQL.USER} & {$MSSQL.PASSWORD}, then have the macro's in the username and password field within the item.
    The key looks as following: "db.odbc.select[,test] , test is ofcourse the name of the dsn in the odbc.ini.

    My odbc.ini looks as following:
    Driver = ODBC Driver 17 for SQL Server
    Server = tcp:Servername,1433.

    I can telnet the server on 1433 from the Zabbix server, and we can see the connection is being made in the mssql server logging.

    The query is as following:

    USE NAV_TEST
    SELECT COUNT (*)
    FROM [NAV_TEST].[dbo].[xxx$AC Log]

    I hope anyone can help me configuring this. Thank you!


  • lptarik
    Member
    • Oct 2021
    • 33

    #2
    Same issue . when i wrote use "DB" got empyt result .I don't know how to run query in every db

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3
      I "think", that you should not use anything else there but selects... skip the "USE"... You can define it already in odbc.ini
      db.odbc.select expects only one answer, after USE, there is empty answer (or at least nothing that can be treated as answer to select)... so rest is skipped maybe...

      Comment

      • IvoWijnen
        Junior Member
        • Jul 2021
        • 2

        #4
        We still haven't been able to fix this on our end, I was hoping someone could respond who might have a little work instruction that we can follow to get this done. Unfortunately I don't have anyone in my circle who can do this sort of thing through Zabbix runs.

        Comment

        • NgRox
          Member
          • Jun 2022
          • 44

          #5
          Bom dia srs.

          Em vez de utilizar "USE database_name" na query. É mais fácil já colocar a database na chave do item.

          ficaria assim:

          Type Information: Database Monitor
          Key: db.odbc.select[,,"Driver=caminho_driver.101;Database=NAV_TEST;S er ver=10.10.10.10;Port=3306]

          Query:
          SELECT COUNT (*)
          FROM [NAV_TEST].[dbo].[xxx$AC Log]


          Espero ter ajudado.

          Atenciosamente!

          Comment

          Working...