Ad Widget

Collapse

Database Query related concern

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vnoc
    Senior Member
    • Sep 2017
    • 115

    #1

    Database Query related concern

    Hi All,

    I was trying to implement database query related alerts and followed the below link but getting an error while executing the query (isql test is what I executed). Destination Database is MySQL/mariadb

    https://www.zabbix.com/documentation...es/odbc_checks

    Kindly help me in fixing this please.







    Attached Files
  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Originally posted by vnoc
    Hi All,

    I was trying to implement database query related alerts and followed the below link but getting an error while executing the query (isql test is what I executed). Destination Database is MySQL/mariadb
    Hello,

    What steps did you follow from this manual and managed to do? Please, show odbc configuration files (odbc.ini and odbcinst.init)?

    Comment

    • vnoc
      Senior Member
      • Sep 2017
      • 115

      #3
      Thanks for your response . At present I have connected to the test database server but here my exact requirement is below and for that I used the link which I mentioned in the above . I am now stuck at
      15.5 Compiling Zabbix with ODBC support

      To enable ODBC support, Zabbix should be compiled with one of following flags:

      --with-iodbc[=ARG] use odbc driver against iODBC package [default=no], --with-unixodbc[=ARG] use odbc driver against unixODBC package

      But I have installed my Zabbix through rpm and how to recompile it and after that how to fulfill the below requirement

      "I want to execute a database query and monitor its output by configuring thresholds through Zabbix."






      Comment

      • kernbug
        Senior Member
        • Feb 2013
        • 330

        #4
        Originally posted by vnoc
        Thanks for your response . At present I have connected to the test database server but here my exact requirement is below and for that I used the link which I mentioned in the above . I am now stuck at
        15.5 Compiling Zabbix with ODBC support

        To enable ODBC support, Zabbix should be compiled with one of following flags:

        --with-iodbc[=ARG] use odbc driver against iODBC package [default=no], --with-unixodbc[=ARG] use odbc driver against unixODBC package

        But I have installed my Zabbix through rpm and how to recompile it and after that how to fulfill the below requirement
        RPM's are already build with ODBC support. You need to create a .my.cnf file in the zabbix user's home directory and register login/password from your database in it, set user rights for the user zabbix. After that you can check the connectivity using the command: sudo -H -u zabbix -s /path/bash -c 'isql ...'. If this command works you can try to setup item in the Zabbix frontend.

        Comment

        • vnoc
          Senior Member
          • Sep 2017
          • 115

          #5

          And where can I find the Zabbix user path. In Zabbix there is 2 options
          Key
          Name
          db.odbc.select[<unique short description>,<dsn>]
          Return first column of the first row of the SQL query result.
          db.odbc.discovery[<unique short description>,<dsn>]
          Transform SQL query result into a JSON object for low-level discovery.


          1 is giving only one column output
          another giving me error as below

          Cannot convert column #2 name to macro

          .
          Actual query I have written is
          select column,count(*) from xxx

          the database connectivity is written in vi /etc/odbc.ini .


          Kindly help me in fulfilling my requirement









          Comment

          • vnoc
            Senior Member
            • Sep 2017
            • 115

            #6
            Can anyone let me know if above requirement is possible in Zabbix or is there any possible way to fulfill the above requirement

            Comment

            • kernbug
              Senior Member
              • Feb 2013
              • 330

              #7
              Originally posted by vnoc
              Can anyone let me know if above requirement is possible in Zabbix or is there any possible way to fulfill the above requirement
              Hi,

              Simple way(without .my.cnf setup):
              4 Set up Items with type Database Monitor

              Comment

              Working...