[ZBX-19617] Zabbix-Agent2 oracle Plugin / oracle.ts.stats Created: 2021 Jun 30  Updated: 2025 Jan 21  Resolved: 2025 Jan 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: 5.4.1
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Igor Assignee: Zabbix Support Team
Resolution: Duplicate Votes: 6
Labels: agent2, database, oraclelinux, performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Oracle Linux, zabbix-agent2-5.4.1-1.el8.x86_64


Attachments: Text File oracle_ts_stats_sqlstatement.txt    
Issue Links:
Duplicate
duplicates ZBX-25320 Zabbix Web Service - Cannot fetch dat... Closed

 Description   

Hello,

there are two problems with zabbix-agent2 Oracle Plugin: oracle.ts.stats Module.

In the Logfile of zabbix-agent2 on Oracle DB Server I found following error messages:

2021/06/30 12:27:58.218117 [Oracle] Cannot fetch data: dpiStmt_execute: ORA-01031: insufficient privileges.
2021/06/30 12:28:01.166956 [Oracle] Cannot fetch data: dpiStmt_execute: ORA-00942: table or view does not exist.
2021/06/30 12:28:12.204910 [Oracle] Cannot fetch data: dpiStmt_execute: ORA-00942: table or view does not exist.
2021/06/30 12:28:58.284318 [Oracle] Cannot fetch data: dpiStmt_execute: ORA-01031: insufficient privileges.
2021/06/30 12:29:01.231361 [Oracle] Cannot fetch data: dpiStmt_execute: ORA-00942: table or view does not exist.
2021/06/30 12:29:12.263698 [Oracle] Cannot fetch data: dpiStmt_execute: ORA-00942: table or view does not exist.

After analysing it, I figured out, that the messages are from oracle.ts.stats module of zabbix-agent2 (The SQL Statement is attached).

 

The reason ist, that some grants are missing to the zabbix_mon User.

From the documentation I shoud create Oracle Account with following grants:

CREATE USER zabbix_mon IDENTIFIED BY <PASSWORD>; – Grant access to the zabbix_mon user. 
GRANT CONNECT, CREATE SESSION TO zabbix_mon; 
GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO zabbix_mon; 
GRANT SELECT ON DBA_TABLESPACES TO zabbix_mon; 
GRANT SELECT ON DBA_USERS TO zabbix_mon; 
GRANT SELECT ON SYS.DBA_DATA_FILES TO zabbix_mon; 
GRANT SELECT ON V$ACTIVE_SESSION_HISTORY TO zabbix_mon; 
GRANT SELECT ON V$ARCHIVE_DEST TO zabbix_mon; 
GRANT SELECT ON V$ASM_DISKGROUP TO zabbix_mon; 
GRANT SELECT ON V$DATABASE TO zabbix_mon; 
GRANT SELECT ON V$DATAFILE TO zabbix_mon; 
GRANT SELECT ON V$INSTANCE TO zabbix_mon; 
GRANT SELECT ON V$LOG TO zabbix_mon; 
GRANT SELECT ON V$OSSTAT TO zabbix_mon; 
GRANT SELECT ON V$PGASTAT TO zabbix_mon; 
GRANT SELECT ON V$PROCESS TO zabbix_mon; 
GRANT SELECT ON V$RECOVERY_FILE_DEST TO zabbix_mon; 
GRANT SELECT ON V$RESTORE_POINT TO zabbix_mon; 
GRANT SELECT ON V$SESSION TO zabbix_mon; 
GRANT SELECT ON V$SGASTAT TO zabbix_mon; 
GRANT SELECT ON V$SYSMETRIC TO zabbix_mon; 
GRANT SELECT ON V$SYSTEM_PARAMETER TO zabbix_mon;

Following additional Grants are required for oracle.ts.stats to start working without errors:

grant select on sys.DBA_DATA_FILES to zabbix_mon;
grant select on sys.DBA_FREE_SPACE to zabbix_mon;
grant select on sys.DBA_TEMP_FILES to zabbix_mon;
grant select on v_$parameter to zabbix_mon;
grant select on GV_$SORT_SEGMENT to zabbix_mon;

After granting of missing grants, oracle.ts.stats starts to work, but there is another problem with it:

It takes a lot of CPU resources and it starts endless immediately again after finishing. Without sleep time between checks. It is allways "on CPU" - again and again and again.

For this moment it is not possible to use it in our environment, because we have to monitor over 20 DBs on same server and oracle.ts.stats takes 1/4 of CPU resources.

Is there a possibility to configure sleep time between checks ?

Thank you for investigation.

 

Best regards



 Comments   
Comment by Igor [ 2021 Jul 01 ]

Additional Information:

I created new tablespace and filled it with data to 100%, but there are no Problem messages in Zabbix for this issue.

I expected some monitoring information, that tablespace is full.

 

In Zabbix-Agent2 Log another error messages:

2021/07/01 06:46:44.848463 [Oracle] Cannot fetch data: context deadline exceeded.
2021/07/01 06:47:05.134995 [Oracle] Cannot fetch data: context deadline exceeded.
2021/07/01 07:11:26.557052 [Oracle] Cannot fetch data: context deadline exceeded.
2021/07/01 07:11:45.058646 [Oracle] Cannot fetch data: context deadline exceeded.
2021/07/01 07:31:25.365836 [Oracle] Cannot fetch data: context deadline exceeded.
2021/07/01 07:31:51.937980 [Oracle] Cannot fetch data: context deadline exceeded.
2021/07/01 07:32:09.404887 [Oracle] Cannot fetch data: context deadline exceeded.

Configured prarameters:

ControlSocket=/tmp/agent.sock
Hostname=server001
Include=/etc/zabbix/zabbix_agent2.d/*.conf
LogFileSize=0
LogFile=/var/log/zabbix/zabbix_agent2.log
PidFile=/var/run/zabbix/zabbix_agent2.pid
Plugins.Oracle.CallTimeout=30
Server=10.200.20.105
ServerActive=10.200.20.105
Timeout=30
Comment by Bruno Marques [ 2022 Jun 08 ]

Hello all,

 

I've the same issue than Igor.

I get the message "Cannot fetch data: context deadline exceeded." on the Oracle: Get tablespaces stats  Item.

Does this error have to do with the number of tablespaces in the DB? The DB has about 66 Tablespaces.
Will it be possible to change the maximum value of tablespaces per Database?

 

Thanks in advance!

 

Kind Regards,

Bruno Marques

 

Comment by Bruno Marques [ 2022 Aug 23 ]

 

Oracle : Cannot fetch data: context deadline exceeded.

 
Hi, someone coult help me ?

Zabbix does not fetch data onto tablespaces ?
My platform is : Windows Server 2012 R2 / Oracle 12.2.0.1.0-SE.

Thank's
*Kind Regards,
*
Bruno Marques

Comment by Gary [ 2024 Apr 16 ]

Dear I have same issue on Linux agent2. version6.0.25. sometime it will report problem in zabbix web page not able to fetch data. Please help~~~.

Comment by Roman Rajniak [ 2024 Apr 22 ]

Hello, I have upgraded Zabbix Agent2 to version 7.0 Beta3  (from 6.4.13) to test future functionality .

After restart new Zabbix Agent2 with this oracle plugin, key oracle.ts.stats  stops work with error [Cannot fetch data: Next: ORA-40595: ...null.]

other not dependent items for oracle works unchanged.

On environment with Oracle I can't test this with latest Zabbix proxy&server version 7.0 Beta3 , and then now servers use only version 6.4.13 . If this is possibly the primary problem for this error, then I apologize. But If this item works with agent in version 6.4.13 then what else? (Config file in plugins.d oracle.conf use default/empty params, and all connection params are defined in  key parameters.)

Problem tested in cmd:

#zabbix_agent2 -c /etc/zabbix/zabbix_agent2.conf -t oracle.ts.stats[tcp://...,...,...,...,...,PERMANENT][m|ZBX_NOTSUPPORTED] [Cannot fetch data: Next: ORA-40595: Name input to JSON generation function cannot be null.]

 

or in zabbix_agent2.log file:

2024/04/22 16:56:11.631643 [Oracle] Cannot fetch data: Next: ORA-40595: Name input to JSON generation function cannot be null.
2024/04/22 16:56:20.762163 [Oracle] Cannot fetch data: Next: ORA-40595: Name input to JSON generation function cannot be null.

Comment by Markus Bergholz [ 2024 Sep 03 ]

> 2024/04/22 16:56:11.631643 [Oracle] Cannot fetch data: Next: ORA-40595: Name input to JSON generation function cannot be null.

We were facing the same error after updating zabbix agent 2 from 6.x to 7.x.  

The problem is solved by updating the Template: https://raw.githubusercontent.com/zabbix/zabbix/release/7.0/templates/db/oracle_agent2/template_db_oracle_agent2.yaml

Comment by Oleksii Zagorskyi [ 2025 Jan 21 ]

Closing this as duplicate, supposedly ZBX-25320

Generated at Wed Jun 25 07:42:53 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.