Ad Widget

Collapse

How can I work Oracle monitoring with Zabbix Agent 2?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rrruhena
    Junior Member
    • Jul 2021
    • 5

    #1

    How can I work Oracle monitoring with Zabbix Agent 2?

    Hello Guys! First post here!

    I am a old zabbix user (since 3.2) and recently, I make a new installation of 5.4 version.

    I want to use the Oracle plugin on zabbix-agent2, but I cant understand how it works or what I am doing wrong.

    I did the follow steps:

    1- I did install zabbix-agent2 on oracle server
    2 - I did create user with privileged content, like specified on Zabbix agent 2 template operation [Zabbix Documentation 5.4]
    3 - I had enable template linux and template Oracle by Zabbix Agent 2
    4 - I had configure template oracle 2 on Macros with oracle connstring, oracle.password and oracle.user

    After doing all of the steps, I received Oracle: Connection to database is unavailable message.

    Reading log files on oracle server, the follow message appears:
    021/07/12 14:25:39.377644 [Oracle] Connection failed: ORA-00000: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://oracle.github.io/odpi/doc/in...ion.html#linux for help.
    But the library exists...

    Anyone can help me?
  • rrruhena
    Junior Member
    • Jul 2021
    • 5

    #2
    Any idea? I can't find more information about this... is there need enable anything on zabbix-agent2?

    Comment

    • rrruhena
      Junior Member
      • Jul 2021
      • 5

      #3
      Where I have to install Oracle instant client? On zabbix Server or on my DB host?

      Comment

      • Hernandes Martins
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Apr 2011
        • 900

        #4
        Zabbix server or Zabbix Proxy
        __

        Att.
        Hernandes Martins - Zabbix Trainer

        Zabbix Brazil Partner - www.luniobr.com

        Zabbix Brazil Community - www.zabbixbrasil.org

        Blog: hernandesmartins.blogspot.com.br

        Skype: hernandss
        Telegram: @MrHernandes

        Español
        Facebook: facebook.com/groups/zabbixlatam
        Telegram: https://t.me/ZabbixEspañol

        Português
        Facebook: facebook.com/groups/zabbixbrasil/
        Telegram: https://t.me/ZabbixBrasil

        Comment

        • rrruhena
          Junior Member
          • Jul 2021
          • 5

          #5
          Ola Hernandes! Obrigado pela ajuda!

          Zabbix Server

          Comment

          • lhmiranda
            Junior Member
            • Sep 2021
            • 1

            #6
            I'm having the same problem, and I tried installing the Oracle Instant Client on the Zabbix Server and I still get the same error.

            Originally posted by Hernandes Martins
            Zabbix server or Zabbix Proxy
            Are you sure it has to be installed on the server? I ask because I get this error on the zabbix agent2 side (installed on the Oracle DB machine), not on the zabbix server.
            I'm afraid of installing the client on the Oracle machine... I know very little about Oracle so I don't want to risk screwing something on our production database.
            Is it safe to install the Instant Client on the Oracle machine?

            Comment

            • adoang
              Junior Member
              • Sep 2021
              • 7

              #7
              I am using oracle for zabbix agent 2 template. only asm is facing error. I use zabbix server 5.0.15 and zabbix agent 2 5.2.7

              please advise.

              Cannot create item: item with the same key "oracle.asm_free_size["{#DG_NAME}"]" already exists.
              Cannot create item: item with the same key "oracle.asm_free_size["{#DG_NAME}"]" already exists.
              Cannot create item: item with the same key "oracle.asm_free_size["{#DG_NAME}"]" already exists.
              Cannot create item: item with the same key "oracle.asm_free_size["{#DG_NAME}"]" already exists.
              Cannot create item: item with the same key "oracle.asm_free_size["{#DG_NAME}"]" already exists.
              Cannot create item: item with the same key "oracle.asm_free_size["{#DG_NAME}"]" already exists.

              Comment

              • splitek
                Senior Member
                • Dec 2018
                • 101

                #8
                Originally posted by adoang
                I am using oracle for zabbix agent 2 template. only asm is facing error. I use zabbix server 5.0.15 and zabbix agent 2 5.2.7

                please advise.
                This is bug in template. Zabbix agent return
                {#DGNAME}
                not
                {#DG_NAME}
                Just edit template and replace every occurrence of
                {#DG_NAME}
                to
                {#DGNAME}

                Comment


                • adoang
                  adoang commented
                  Editing a comment
                  Hi,
                  thanks this is correct. but the asm is not loaded. Now the other issue is coming. please advise.

                  Preprocessing failed for: [{"ASM_ARC":{"total_bytes":214744170496,"free_bytes ":209136386048,"used_pct":2.61}},{"ASM_ARC...
                  1. Failed: cannot extract value from json by path "$..['ASM_ARC'].size_byte.first()": no data matches the specified path
              • splitek
                Senior Member
                • Dec 2018
                • 101

                #9
                Please check items located in this template in discovery rule named "ASM disk groups discovery". There are items that have preprocessing and preprocessing is using this bad "#DG_NAME". I've also replaced this "#DG_NAME" to "#DGNAME" in preprocessing.

                Another error I found in JSONPATH:
                original JSONPATH:
                Code:
                $..['{#DG_NAME}'].free_size_byte.first()
                new JSONPATH:
                Code:
                $..['{#DGNAME}'].free_bytes.first()
                Replaced:
                "free_size_byte" to "free_bytes"
                "used_percent" to "used_pct"
                "size_byte" to "total_bytes"
                Last edited by splitek; 16-11-2021, 17:56.

                Comment


                • adoang
                  adoang commented
                  Editing a comment
                  This is working perfectly. thank you

                  is this templete will work with 11G or 12.1 version ?
              • splitek
                Senior Member
                • Dec 2018
                • 101

                #10
                is this templete will work with 11G or 12.1 version ?
                No.
                Developers tested this on: Oracle Database, version 12c2, 18c, 19c

                From Oracle 12 there were big changes... pluggable DB (CDB, non-CDB, PDB), multitenant etc. But most important is that from v12 Oracle supports JSON and Zabbix agent 2 Oracle Plugin is using this JSON to get statistics from DB.
                If you have older Oracle DB version then you need to use some other templates.

                Comment


                • adoang
                  adoang commented
                  Editing a comment
                  Hi Splitek,

                  Thanks for your help. for 11G and 12.1 version , I use ODBC templete.

                  can you please let me know how to add the Operational data % with bytes values ?

                  Problem: Oracle TBS 'MY_TBS': Tablespace usage is too high (over 85% for 5m).
                  Problem started at 14:01:29 on 2021.11.23
                  Host: myoracledbhost-sql
                  Severity: Warning
                  Operational data: 87.43 % +++ (100 MB) +++
                  Original problem ID: 1901826
              • splitek
                Senior Member
                • Dec 2018
                • 101

                #11
                I don't know if I can help with that, but in general... in "operational data" in trigger we must use macros. Macro {ITEM.LASTVALUE} as is written here https://www.zabbix.com/documentation...ed_by_location is "The latest value of the Nth item in the trigger expression that caused a notification." So, if trigger is like this:
                Code:
                {somehost:oracle.tbs_used_file_pct["SYSAUX"].min(5m)}>{$ORACLE.TBS.USED.PCT.MAX.HIGH}
                then our macro will resolve to value inside item with key:
                Code:
                oracle.tbs_used_file_pct["SYSAUX"]
                on host named "somehost"
                We can not add not used metrics in trigger to "operational data", but some people here use trick. Trick is to add to trigger another expression, expression that will always be true. And this expression must of course use our metric needed in "operational data".
                I never used that trick, but I think our trigger can look like that:
                Code:
                ({somehost:oracle.tbs_used_bytes["SYSAUX"].last()}>-1
                AND
                {somehost:oracle.tbs_used_file_pct["SYSAUX"].min(5m)})>{$ORACLE.TBS.USED.PCT.MAX.HIGH}
                First line should always resolve to "true". In this line we have item with "Tablespace used, bytes". We can use this in "operatiopna data", put {ITEM.LASTVALUE1} ("1" at end is because our item is first item in trigger expression).
                Last edited by splitek; 24-11-2021, 12:03.

                Comment

                • gspoli
                  Junior Member
                  • Dec 2021
                  • 4

                  #12
                  Hello.

                  Could you get tablespaces info form CBDs and all PDBs?
                  In mine installation I was able to get or cdb or one pdb not all.

                  Comment

                  • splitek
                    Senior Member
                    • Dec 2018
                    • 101

                    #13
                    I don't need tablespace info form PDBs (my DB have to many of them to give usefull info).
                    I think it will not work because LLD discovers Oracle tablespaces names (LLD macro is {#TABLESPACE}), and some tablespaces in different PDBs can have the same name (like SYSTEM). Items creaded by the TBS LLD rule have names like: "Oracle TBS '{#TABLESPACE}': Tablespace allocated, bytes", so Zabbix will try create two the same items and will fail. So I think this is the reason why PDBs tablespaces are not discovered.

                    You can... clone template, remove everything from it except LLD "Tablespace discovery", make another host only for specific PDB teblespaces. So you end up with separate host for every PDB.

                    Template can be extended to discover all tablespaces in all PDBs, but this approach needs that LLD rule get not lonely TBS name but "PDB name with tablespace name".
                    I mean, if agent use query like in this expamle: https://docs.oracle.com/en/database/...2643__CHDHDICB
                    and LLD macro {#TABLESPACE} do not get only "SYSTEM" but:
                    HRPDB-SYTSTEM
                    SALESPDB-SYSTEM
                    then it will work.
                    But it is up to dev to add this query to agent (or you can try implement this by custom query).

                    Comment

                    • gspoli
                      Junior Member
                      • Dec 2021
                      • 4

                      #14
                      Thank you very much for you answer splitek

                      Comment

                      • adoang
                        Junior Member
                        • Sep 2021
                        • 7

                        #15
                        Hi

                        I put an plugin in zabbix agent 2 conf


                        Plugins.Oracle.Sessions.OraOp.Uri=tcp://127.0.0.1:1521
                        Plugins.Oracle.Sessions.OraOp.User=zabbix
                        Plugins.Oracle.Sessions.OraOp.Password=<password>
                        Plugins.Oracle.Sessions.OraOp.Service=opdb

                        ================================================== ==========
                        zabbix_get -s 127.0.0.1 -k oracle.ping[OraOp]

                        ZBX_NOTSUPPORTED: Unknown metric oracle.ping

                        ================================================== ==========

                        zabbix_get -s 127.0.0.1 -k oracle.ping[opdb]

                        ZBX_NOTSUPPORTED: Unknown metric oracle.ping
                        and how do i put in item on frontend ?

                        because when I put oracle.ping[OraOp]

                        Unknown metric oracle.ping
                        Last edited by adoang; 09-04-2022, 20:06.

                        Comment

                        Working...