Ad Widget

Collapse

Zabbix 3.2 - I can't query oracle database

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LITWIN
    Junior Member
    • Nov 2016
    • 16

    #1

    Zabbix 3.2 - I can't query oracle database

    I have problem with query Oracle database (12c) from zabbix 3.2 (installed on Centos 7 + zabbix from rpm packages).
    I also installed oracle instant-client and ODBC package.

    I need to query database with different queries. Now I created item "Database monitor" with simple query.
    In item page is described now as "Not supported".


    [root@zabbix3 ~]# yum list installed | grep -i odbc
    mysql-connector-odbc.x86_64 5.2.5-6.el7 @RHEL-7.2
    oracle-instantclient12.1-odbc.x86_64 12.1.0.2.0-1 @/oracle-instantclient12.1-odbc-12.1.0.2.0-1.x86_64
    php-odbc.x86_64 5.4.16-36.el7_1 @RHEL-7.2
    unixODBC.x86_64 2.3.1-11.el7 @base
    unixODBC-devel.x86_64 2.3.1-11.el7 @RHEL-7.2

    [root@zabbix3 ~]# yum list installed | grep -i oracle
    oracle-instantclient12.1-basic.x86_64 12.1.0.2.0-1 @/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64
    oracle-instantclient12.1-devel.x86_64 12.1.0.2.0-1 @/oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64
    oracle-instantclient12.1-jdbc.x86_64 12.1.0.2.0-1 @/oracle-instantclient12.1-jdbc-12.1.0.2.0-1.x86_64
    oracle-instantclient12.1-odbc.x86_64 12.1.0.2.0-1 @/oracle-instantclient12.1-odbc-12.1.0.2.0-1.x86_64
    oracle-instantclient12.1-sqlplus.x86_64 12.1.0.2.0-1 @/oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64
    -- odbc.ini configuration
    [root@zabbix3 ~]# cat /etc/odbc.ini
    [<DATABASE NAME>]
    Driver=Oracle
    ServerName=//aa.bb.cc.dd:1521/<service name>
    Database=<DATABASE LINK NAME>
    DSN=<DATABASE NAME>
    Port=1521
    #UserID=MY_DATABASE_USER>
    #Password=DATABASE_USER_PASSWORD

    I created odbc connection and it's fully working from OS commandline.
    Also manually and as command.

    Fired up manually - works.
    [root@zabbix3 ~]# isql -v <DATABASE LINK NAME> <USERNAME>/<PASSWORD> -b < sql.txt
    +-----------------------------------------+
    | COUNT(1) |
    +-----------------------------------------+
    | 465 |
    +-----------------------------------------+
    SQLRowCount returns -1
    1 rows fetched

    [root@zabbix3 ~]# isql -v <DATABASE LINK NAME> <USERNAME>/<PASSWORD>
    +---------------------------------------+
    | Connected! |
    | |
    | sql-statement |
    | help [tablename] |
    | quit |
    | |
    +---------------------------------------+
    SQL> select count(1) from sm_zas_obiekty_glowne
    +-----------------------------------------+
    | COUNT(1) |
    +-----------------------------------------+
    | 465 |
    +-----------------------------------------+
    SQLRowCount returns -1
    1 rows fetched
    -- I can also get that data from shell (create a script?), but this is not acceptable solution for me.
    [root@zabbix3 ~]# isql -v <DATABASE NAME> <USERNAME>/<PASSWORD> -b < sql.txt | head -4 | tail -1 | awk '{print $2}'
    465



    -- In zabbix debug log i see that:
    41821:20161121:085047.824 In odbc_DBconnect() db_dsn:'<DATABASE NAME>' user:'<DATABASE USERNAME>'
    41821:20161121:085047.910 End of odbc_DBconnect():SUCCEED
    41821:20161121:085047.910 In odbc_DBselect() query:'select count(1) from sm_zas_obiekty_glowne'
    41821:20161121:085047.914 odbc_DBselect() selected 1 columns
    41821:20161121:085047.914 End of odbc_DBselect()
    41821:20161121:085047.914 In odbc_DBfetch()
    41821:20161121:085047.915 odbc_Diag(): rc_msg:'SQL_SUCCESS_WITH_INFO' rec_nr:1 sql_state:'01004' native_err_code:0 err_msg:'[Oracle][ODBC]String data, right truncated.'
    41821:20161121:085047.915 odbc_DBfetch() fetched [0 col]: '<B8>W<A1><A1><95>^?'
    41821:20161121:085047.915 End of odbc_DBfetch()
    41821:20161121:085047.919 End of db_odbc_select():NOTSUPPORTED
    41821:20161121:085047.919 End of get_value_db():NOTSUPPORTED
    41821:20161121:085047.919 Item [proxy2b.kgp.lan:db.odbc.select[<DATABASE NAME>_test,<DATABASE NAME>]] error: Received value [?W???^?] is not suitable for value type [Numeric (float)]
    41821:20161121:085047.919 End of get_value():NOTSUPPORTED
    41821:20161121:085047.919 In activate_host() hostid:10177 itemid:24047 type:11
    41821:20161121:085047.919 End of activate_host()
    41821:20161121:085047.919 End of get_values():1

    = it's look like there are problem with connect to database.
    41821:20161121:085047.915 odbc_Diag(): rc_msg:'SQL_SUCCESS_WITH_INFO' rec_nr:1 sql_state:'01004' native_err_code:0 err_msg:'[Oracle][ODBC]String data, right truncated.'
    41821:20161121:085047.915 odbc_DBfetch() fetched [0 col]: '<B8>W<A1><A1><95>^?'

    I tried:
    - add/remove user + password to odbc configuration.
    - use password (or without it when added to odbc) in zabbix configuration
    - change type of data gathered from zabbix to text / log
    - change number precision (float / usigned)

    ... all without success. As I see, this is a problem with connection to database.
    It's strange because it's work without any problem from linux commandline (in both version with password in odbc or without it (isql -v <DATABASE LINK>)

    Any help?
  • Answer selected by LITWIN at 23-01-2025, 10:27.
    LITWIN
    Junior Member
    • Nov 2016
    • 16

    I downloaded 3.2.2 from zabbix repo and finally it works!
    Last edited by LITWIN; 12-12-2016, 10:03.

    Comment

    • LITWIN
      Junior Member
      • Nov 2016
      • 16

      #2
      One note : from time to time this connection message from database in log (Received value [....]) are changed from one to another - like [?G?t] or [XSWISS] [?] [?H?t] - like random value ... :/

      Comment

      • m.levin
        Junior Member
        • Nov 2016
        • 1

        #3
        Problem in zabbix API createHost function

        I am trying to create host by createHost API function as follows:

        $api = new ZabbixApi('http://localhost/zabbix/api_jsonrpc.php', 'Admin', 'zabbix');

        $host['host'] = "Linux91";

        $host['groups']['name'] = "Linux servers";
        $host['groups']['groupid'] = 2;

        $host['interfaces']['type'] = 2;
        $host['interfaces']['main'] = 1;
        $host['interfaces']['useip'] = 1;
        $host['interfaces']['ip'] = "172.17.22.33";
        $host['interfaces']['dns'] = "172.18.22.33";
        $host['interfaces']['port'] = 10050;

        $hosts = $api->hostCreate( $host );

        But I have the following error:

        API error -32500: No permissions to referred object or it does not exist!

        Other API functions such $api->userLogin, $api->hostgroupGet work well.

        Anybody could help me?

        Regards, Mikhail

        Comment

        • Atsushi
          Senior Member
          • Aug 2013
          • 2028

          #4
          Hi LITWIN,
          Please check this bug.

          ZBX-11213
          DB Monitoring stopped working after upgrade to 3.2

          Comment

          • LITWIN
            Junior Member
            • Nov 2016
            • 16

            #5
            As I see, this bug is for version 3.0.5 and is repaired in 3.0.6+ branch.

            Yes,
            Released in pre-3.0.6rc1 r62901
            means that the fix was merged in 3.0.6 release candidate branch and will be released with 3.0.6
            Now I have 3.2.1 (successor of 3.0.6, so this error are fixed?)

            I'm not tested is this works in 3.0 version, I just upgraded from 3.0 -> 3.2.1 and started my configuration....

            Error in this bug are different that my own.
            Last edited by LITWIN; 23-11-2016, 09:44.

            Comment

            • Atsushi
              Senior Member
              • Aug 2013
              • 2028

              #6
              This bug seems to be confirmed in the following versions.
              2.2.15
              3.0.5
              3.2.1
              As written in the Fix Version/s, it will be fixed in the next release.

              Comment

              • LITWIN
                Junior Member
                • Nov 2016
                • 16

                #7
                @Atsushi

                http://www.zabbix.com/life_cycle_and_release_policy

                = This mean I must wait until march 2017 to get my zabbix work?

                Comment

                • mark.chan
                  Member
                  • Mar 2016
                  • 35

                  #8
                  Hi,
                  I got the same problem with you, as I was using yum to install 3.0.5,
                  but I don't know how to use the source code to install the zabbix at the same directory with the existing one.

                  I am afraid installed two zabbix at the same time...
                  I had found the source, would any one can help?
                  http://www.zabbix.com/downloads/nigh...1-63962.tar.gz
                  Last edited by mark.chan; 24-11-2016, 12:01.

                  Comment

                  • mark.chan
                    Member
                    • Mar 2016
                    • 35

                    #9
                    LITWIN, for 3.2, you can try this : pre-3.2.2rc1 r62902
                    Here is the source
                    http://www.zabbix.com/downloads/nigh...1-63963.tar.gz
                    Last edited by mark.chan; 24-11-2016, 12:02.

                    Comment

                    • Atsushi
                      Senior Member
                      • Aug 2013
                      • 2028

                      #10
                      Hi LITWIN,
                      The release of 3.4 is scheduled for March 2017.
                      But 3.2.2 will be released before that.
                      I do not know when it will be.

                      Since the link that mark.chan introduces is a development version,
                      it may not function properly.

                      Comment

                      • LITWIN
                        Junior Member
                        • Nov 2016
                        • 16

                        #11
                        Originally posted by mark.chan
                        LITWIN, for 3.2, you can try this : pre-3.2.2rc1 r62902
                        Here is the source
                        http://www.zabbix.com/downloads/nigh...1-63963.tar.gz
                        Not Found

                        The requested URL /downloads/nightly/pre-zabbix-3.2.2rc1-63963.tar.gz was not found on this server.
                        Where I can find version without error in zabbix server to compile it myself?

                        ==========
                        Ok, I found: http://www.zabbix.com/developers
                        Last edited by LITWIN; 29-11-2016, 10:52.

                        Comment

                        • GPegel
                          Senior Member
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Dec 2015
                          • 113

                          #12
                          I have exactly the same error with version 3.2.1. And also with version 3.2.2rc1

                          I've installed it on a virtual machine and I see the same results in the zabbix_server.log as in version 3.2.1 so it seems the bug is still there.

                          Last edited by GPegel; 30-11-2016, 16:59. Reason: added image

                          Comment

                          • LITWIN
                            Junior Member
                            • Nov 2016
                            • 16

                            #13
                            Reopened ticket with error (previously they joined it to ZBX-11213 as same error and marked as repaired in 3.2.2.rc1).

                            Last edited by LITWIN; 02-12-2016, 09:52.

                            Comment

                            • GPegel
                              Senior Member
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Dec 2015
                              • 113

                              #14
                              I saw an comment about the updated frontend... of course it's also the server that is running on version 3.2.2.rc1. Not only the frontend, also the database etc.

                              Comment

                              • glebs.ivanovskis
                                Senior Member
                                • Jul 2015
                                • 237

                                #15
                                Maybe you can provide a log file with DebugLevel=4?

                                Comment

                                Working...