[ZBX-26565] Oracle by Zabbix Agent 2 discovery fails to create items for PDB tablespaces Created: 2025 Jun 16  Updated: 2025 Aug 21

Status: Confirmed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G), Templates (T)
Affects Version/s: None
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Steven B. Assignee: Zabbix Integration Team
Resolution: Unresolved Votes: 1
Labels: oracle
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File template_db_oracle_agent2.patch    
Issue Links:
Duplicate
is duplicated by ZBX-25944 usage of con$name causes broken colle... Closed

 Description   

Steps to reproduce:

  1. Assign the "Oracle by Zabbix Agent 2" to a server running (in this case) Oracle Database 19c Enterprise Edition
  2. run the PDB Discovery

Result:
**

Cannot create item: item with the same key "oracle.pdb.info"{$ORACLE.CONNSTRING}","{$ORACLE.USER}","{$ORACLE.PASSWORD}","{$ORACLE.SERVICE}","{#CON_ID}"" already exists.
Cannot create item: item with the same key "oracle.pdb_open_mode"{#CON_ID}"" already exists.

Expected:

No error and items created

Extra info:

The discovery rule returns this data:

 

[{"{#DBNAME}":"PDB$SEED"},{"{#DBNAME}":"**********"}] 

 

There is no {#CON_ID} in the result set.  Replacing {#CON_ID} by {#DBNAME} in both Item Prototypes solves the issue in this case, but not sure if this is a valid solution for multiple CDB/PDB's



 Comments   
Comment by Steven B. [ 2025 Jun 16 ]

Cannot edit, so follow up in commets:

Same happens in discovery rule "Tablespace Discovery".  Here is {#CON_ID} also used but that parameter is not available.

[
{"\{#TABLESPACE}":"SYSTEM","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"CDB$ROOT"},{"{#TABLESPACE}
":"SYSAUX","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"CDB$ROOT"},
{"\{#TABLESPACE}":"UNDOTBS1","{#CONTENTS}":"UNDO","{#CON_NAME}":"CDB$ROOT"},{"{#TABLESPACE}
":"TEMP","{#CONTENTS}":"TEMPORARY","{#CON_NAME}":"CDB$ROOT"},
{"\{#TABLESPACE}":"USERS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"CDB$ROOT"},{"{#TABLESPACE}
":"SYSTEM","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"SYSAUX","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"UNDOTBS1","{#CONTENTS}":"UNDO","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"TEMP","{#CONTENTS}":"TEMPORARY","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"USERS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUF12214_IAS_OPSS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"RCUF12214_IAS_TEMP","{#CONTENTS}":"TEMPORARY","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUF12214_IAU","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"RCUF12214_MDS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUF12214_STB","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"RCUF12214_WLS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUB12214_IAU","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"RCUB12214_WLS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUB12214_IAS_TEMP","{#CONTENTS}":"TEMPORARY","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"RCUB12214_MDS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUB12214_BIPLATFORM","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"RCUB12214_IAS_OPSS","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},
{"\{#TABLESPACE}":"RCUB12214_STB","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"**********"},{"{#TABLESPACE}
":"*********","{#CONTENTS}":"PERMANENT","{#CON_NAME}":"*********"}
]

 

Channging the {#CON_ID} macro by {#CON_NAME} in the Item Prototypes solves the problem here

Comment by Raimond Kollman [ 2025 Jul 01 ]

Yesterday at a client we also experienced this problem after upgrading this template. We wanted to use this new one based on #CON_ID instead of #CON_NAME as it would improve performance (and so not loosing any metrics), but due to this bug the discovery of tablespaces failed and we had to move back to 7.0-1 version of the template.

Comment by Alexey Pustovalov [ 2025 Aug 14 ]

According to sources of Zabbix agent 2 result of discovery should contain CON_ID macro: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/go/plugins/oracle/handler_pdb_discovery.go#32. Please tell us exact version of the template and Zabbix agent 2.

Comment by Raimond Kollman [ 2025 Aug 14 ]

Hi, the template version is the most recent (7.0-2) and the used Zabbix server and Agent at that time was 7.0.15.

As mentioned, we moved back to 7.0-1 for the template.

Comment by Steven B. [ 2025 Aug 14 ]

Almost the same here.

Template: 7.0-2

Agent:

  • zabbix_agent2 (Zabbix) 7.0.17 
  • Revision 77c670937ef 23 July 2025
  • Plugin communication protocol version is 6.4.0

 

I think Agent2 has been updated since, and this is what I get now from Database Discovery:

 

[ { "{#DBNAME}" : " ***** " , "{#TYPE}" : "CDB" } ] 
[ { "{#DBNAME}" : " ***** " , "{#TYPE}" : "No-CDB" } ]  

 

 

Comment by Alexey Pustovalov [ 2025 Aug 15 ]

The issue is fixed since 7.0.14 version in ZBX-25944. Please update template to 7.0-2 and Zabbix agent 2 to at least 7.0.14 version.

Comment by Steven B. [ 2025 Aug 20 ]

Hi Alexey,

This is only solved for pluggable DB discovery; if not using PDB's there is no CONN_ID value. See here:

Source of handler_databases_discovery.go - Zabbix - ZABBIX GIT

Generated at Mon Sep 29 21:56:21 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.