配置Zabbix之监控Oracle数据库(Orabbix 方式)

配置Zabbix之监控Oracle数据库(Orabbix 方式)

Orabbix是一个用来监控Oracle数据库性能的Zabbix插件工具,通过安装在被监控服务器上客户端上收集数据并传给Zabbix服务器端,然后通过调用图形显示。

image-20231108112051253

  • 往zabbix服务器上传需要的组件:

Orabbix-1.2.3.zip :主要监控程序包,调用jdbc连接oracle数据库来提取性能指标。

Ojdbc8.jar: 用来替换orabbix-1.2.3.zip 展开后的ojdbc6.jar

Orabbix-1.2.3.jar :用来替换orabbix-1.2.3.zip 展开后的orabbix-1.2.3.jar

image-20231108112124685

  • 解压缩orabbix-1.2.3.zip文件

image-20231108112142374

  • 对程序增加可执行权限

image-20231108112201142

  • 复制ojdbc8.jar到lib目录下,同时删除lib 目录下的ojdbc6.jar

image-20231108112221302

  • 修改配置文件

cp /opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props

同时定制化查询指标参数文件

image-20231108112245670

vi /opt/orabbix/conf/querybill.props

DefaultQueryPeriod=2

QueryList=z_mydbfilesize,z_all_tables,z_pgahitper,z_poolshare,z_dic_CacheHitRatio,z_DeadLock,z_buf_HitRatio,z_pct_HitRatio

z_mydbfilesize.Query=select sum(bytes/1024/1024/10) from dba_data_files

z_all_tables.Query=select count(*) from all_all_tables

z_pgahitper.Query=SELECT value FROM V$PGASTAT WHERE NAME='cache hit percentage'

z_poolshare.Query=select round(sum(pinhits-reloads)/sum(pins)*100,2) from v$librarycache

z_dic_CacheHitRatio.Query=SELECT ROUND(( 1 - SUM( getmisses ) / SUM( gets )) * 100, 1 ) FROM v$rowcache

z_DeadLock.Query=select count(*) from v$session where sid in (select session_id from v$locked_object)

z_buf_HitRatio.Query=select (1 - (sum(decode(name, 'physical reads',value,0)) / \

(sum(decode(name, 'db block gets',value,0)) + \

sum(decode(name, 'consistent gets',value,0))))) * 100 from v$sysstat

z_pct_HitRatio.Query=select round((100*b.value)/decode((a.value+b.value),0,1,(a.value+b.value)),2) \

from v$sysstat a, v$sysstat b where a.name = 'sorts (disk)' and b.name = 'sorts (memory)'

  • 安装jdk

yum install -y java-1.8.0-openjdk-devel

image-20231108112336277

  • 启动orabbix

cp /opt/orabbix/init.d/orabbix /etc/init.d/

chkconfig --add orabbix

systemctl enable orabbix

systemctl start orabbix

systemctl status orabbix

image-20231108112404118

  • 查看log

tail -f /opt/orabbix/logs/orabbix.log

image-20231108112432782

  • Zabbix server端设定

创建主机群组:Oracle_Group

image-20231108112456173

导入orabbix的oracle模版:orabbix_export_full.xml

image-20231108112515789

image-20231108112529444

image-20231108112540724

链接orabbix_export_full模版创建定制化模版:Temp_Oracle,加入到Oracle_Group 组中。

image-20231108113007030

image-20231108113017661

image-20231108113029798

创建主机:DB1

image-20231108113223437

链接Temp_Oracle 模版

image-20231108113244645

添加在定制化查询指标(querybill.props)里面的指标项目

image-20231108113307238

确认获得监控数据

image-20231108113330909

posted @ 2023-11-08 11:34  寻梦99  阅读(1494)  评论(0)    收藏  举报