[ZBXNEXT-8408] Insufficient monitoring on Oracle CDB/PDB Created: 2023 Apr 19  Updated: 2024 Aug 27

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Medium
Reporter: Martins Orinskis Assignee: Unassigned
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File handler_sysmetrics.go     PNG File image-2024-04-06-20-16-44-621.png    

 Description   

Scope:
Oracle DB with CDB/PDB - Zabbix templates oracle_agent2 and "Oracle by ODBC"

Use case:
I have Oracle DB (cdb - Container database) instance with more than 100 DB (pdb - pluggable  databases).

Pain point:
Zabbix agent2 and "Oracle by ODBC" is capable to gather only CDB instance stats (from V$SYSMETRIC), 
but no PDB stats (from V$CON_SYSMETRIC) - it is not possible to monitor PDBs directly with "Oracle by ODBC" due to V$SYSMETRIC for PDB is empty and it is huge overhead.

Requirement:
I want to monitor not only CDB instance, but also performance of all PDBs.

Solution:
Add capability to discover all PDBs from CDB instance and all related metrics (e.g. tablespaces, sysmetrics, ... ):

  • add rules to gather metrics for discovered PDBs;
  • change template/agent logic to read data from "V$CON_*" tables when needed.


 Comments   
Comment by Wang Xiao Dong [ 2024 Apr 06 ]

An alternative solution:

We can add two host for the CDB and the PDB each other within the same agent2. We need set the monitor user for the CDB and the PDB and set the macroes.

 

Because the v$sysmetic on PBD return nothing, there are 26 not supported items for the PDB.

I have try to  use the the v$con_sysmetic on PDB, but because the v$sysmetic on CDB and the v$con_sysmetic on PDB have diffirent results, there are some not supported items until Oracle make the v$sysmetic on CDB and the v$con_sysmetic on PDB have the same results.

zabbix-5.0.41/src/go/plugins/oracle/handler_sysmetrics.go

//代码占位符
        row, err := conn.QueryRow(ctx, `
                SELECT
                        COUNT(*)
                FROM
                        V$SYSMETRIC
        `)        if err != nil {
                return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
        }
        row.Scan(&cn)
        if cn == 0 {
        // for PDB
        row, err := conn.QueryRow(ctx, `
                SELECT
                        JSON_OBJECTAGG(METRIC_NAME VALUE ROUND(VALUE, 3) RETURNING CLOB)
                FROM
                        V$CON_SYSMETRIC
        `)
        if err != nil {
                return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
        }        err = row.Scan(&sysmetrics)
        if err != nil {
                return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
        }
        } else {
        // for CDB
        row, err := conn.QueryRow(ctx, `
                SELECT
                        JSON_OBJECTAGG(METRIC_NAME VALUE ROUND(VALUE, 3) RETURNING CLOB)
                FROM
                        V$SYSMETRIC
                WHERE
                        GROUP_ID = :1
        `, groupID)
        if err != nil {
                return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
        }        err = row.Scan(&sysmetrics)
        if err != nil {
                return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
        }
        }
 

handler_sysmetrics.go

 

 

 

 

 

Comment by Studer Olivier [ 2024 Aug 27 ]

Hi Dong,

I'm interesting about your solution to modify the handler_sysmetrics.go file for Oracle. I use the package Zabbix server 6.4.18 version on RedHat. 

So, I need help to implement your solution.

Regards

Olivier

Generated at Tue May 20 08:30:21 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.