ikzelf / zbxdb

Zabbix database monitoring, the easy and extendable way
GNU General Public License v3.0
94 stars 45 forks source link

Items of group "objects" in zbxdb_template_v4 for ORACLE 11 don't collect data #38

Closed weetalyg closed 4 years ago

weetalyg commented 4 years ago

Hello, Items of group "objects" in zbxdb_template_v4 for ORACLE 11 don't collect any data.

oracle database 11, db_type = oracle db_driver = cx_Oracle instance_type = rdbms role = normal

For example, zbxdb_template_v4 waits data with key:

objects[{#PDB},{#SCHEMA},INVALID,count]

but script in etc\zbxdb_checks\oracle\primary.11.cfg

obj.stat: with all_status as ( select 'INVALID' status from dual union all select 'VALID' status from dual ) , schemas as ( select distinct s.owner, a.status from dba_objects s cross join all_status a ) select 'objects[,' | | a.owner | |',' | | a.status | |',count]', count(obj.status) from schemas a left join dba_objects obj on(a.status=obj.status and a.owner=obj.owner) group by a.status, a.owner

In result: first parameter is empty

I think that right script is:

obj.stat: with all_status as ( select 'INVALID' status from dual union all select 'VALID' status from dual ) , schemas as ( select distinct s.owner, a.status from dba_objects s cross join all_status a ) select 'objects[' | | d.name | | ',' | | a.owner | |',' | | a.status | |',count]', count(obj.status) from schemas a left join dba_objects obj on(a.status=obj.status and a.owner=obj.owner) , v$database d group by a.status, d.name, a.owner

It works for me.

ikzelf commented 4 years ago

Thanks for the report & the fix