Orabbix简介
Orabbix是设计用来为zabbix监控Oracle的数据库的插件,它提供多层次的监控,包括可用性和服务器性能的指标。
Orabbix监控的内容:
1. 数据库版本
2. 归档文件
3. 等待的事件(如文件的I/O,单块的读,多块的读,直接读,SQLNet消息,控制文件I/O,日志写等)
4. HitRatio(监控Hit Ratio的触发,表/存储过程,SQLArea,Body)
5. 逻辑I/O(当前读操作,持续的读操作,块的更改)
6. PGA
7. SGA(固定的缓冲,JAVApool,Large Pool,Log Buffer,Shared Pool,Buffer Cache)
8. 物理I/O(重写操作,数据文件写操作,数据文件读操作)
9. SharePool(PoolDictionary Cache, Pool Free Memory, Library Cache,Sql Area ,Misc.)
10. Pin Hit Ratio(monitor Hit Ratio on Trigger, Tables/Procedures, SQLArea,Body)
11. Session/Processes(monitor Sessions and processes)
12. Session (ActiveSession, Inactive Sessions, System Session)
安装步骤如下:
1、JAVA环境配置
若是没有java 需要安装JDK环境:
jdk官方下载地址 http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
mkdir /usr/lib/jvm/
tar -xvf jdk-7u80-linux-x64.tar.gz -C /usr/lib/jvm/
echo "export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_80" >> /etc/profile
source /etc/profile
echo "export JRE_HOME=${JAVA_HOME}/jre" >> /etc/profile
source /etc/profile
echo "export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib" >> /etc/profile
echo "export PATH=${JAVA_HOME}/bin:$PATH" >> /etc/profile
source /etc/profile
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_80/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_80/bin/javac 300
安装完毕查看版本:
[root@dbnode1 opt]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
2、Orabbix插件的下载安装
http://www.smartmarmot.com/product/orabbix/download/
也可以直接搜索下载,目前最新版本为1.2.3
创建一个目录作为orabbix的源地址:
mkdir -p /usr/local/orabbix
解压缩插件:
unzip -n orabbix-1.2.3.zip -d /usr/local/orabbix/
3、更改配置文件:
cd /usr/local/orabbix/
cp conf/config.props.sample conf/config.props
添加系统启动脚本:
cp init.d/orabbix /etc/init.d/orabbix
并修改路径:
vim /etc/init.d/orabbix
orabbix=/usr/local/orabbix
给启动脚本加执行权限
chmod +x /usr/local/orabbix/run.sh
chmod +x /etc/init.d/orabbix
修改配置文件内如如下
cat /usr/local/orabbix/conf/config.props | grep -v "^$"|grep -v "^#"
ZabbixServerList=ZabbixServer1
ZabbixServer1.Address=192.168.3.209
ZabbixServer1.Port=10051
OrabbixDaemon.PidFile=./logs/orabbix.pid
OrabbixDaemon.Sleep=300
OrabbixDaemon.MaxThreadNumber=100
DatabaseList=dbnode1
DatabaseList.MaxActive=10
DatabaseList.MaxWait=100
DatabaseList.MaxIdle=1
dbnode1.Url=jdbc:oracle:thin:@192.168.2.110:1521:ORCL
dbnode1.User=zabbix
dbnode1.Password=xxxxxxxx
dbnode1.MaxActive=10
dbnode1.MaxWait=100
dbnode1.MaxIdle=1
dbnode1.QueryListFile=./conf/query.props
4、使用DBA账号登陆oracle控制台,创建zabbix用户并赋权
CREATE USER ZABBIX IDENTIFIED BY ZABBIX2018 DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
GRANT ALTER SESSION TO ZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANT CONNECT TO ZABBIX;
GRANT RESOURCE TO ZABBIX;
ALTER USER ZABBIX DEFAULT ROLE ALL;
GRANT SELECT ON V_$INSTANCE TO ZABBIX;
GRANT SELECT ON DBA_USERS TO ZABBIX;
GRANT SELECT ON V_$LOG_HISTORY TO ZABBIX;
GRANT SELECT ON V_$PARAMETER TO ZABBIX;
GRANT SELECT ON SYS.DBA_AUDIT_SESSION TO ZABBIX;
GRANT SELECT ON V_$LOCK TO ZABBIX;
GRANT SELECT ON DBA_REGISTRY TO ZABBIX;
GRANT SELECT ON V_$LIBRARYCACHE TO ZABBIX;
GRANT SELECT ON V_$SYSSTAT TO ZABBIX;
GRANT SELECT ON V_$LATCH TO ZABBIX;
GRANT SELECT ON V_$PGASTAT TO ZABBIX;
GRANT SELECT ON V_$SGASTAT TO ZABBIX;
GRANT SELECT ON V_$LIBRARYCACHE TO ZABBIX;
GRANT SELECT ON V_$PROCESS TO ZABBIX;
GRANT SELECT ON DBA_DATA_FILES TO ZABBIX;
GRANT SELECT ON DBA_TEMP_FILES TO ZABBIX;
GRANT SELECT ON DBA_FREE_SPACE TO ZABBIX;
GRANT SELECT ON V_$SYSTEM_EVENT TO ZABBIX;
GRANT SELECT ANY TABLE TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;
GRANT UNLIMITED TABLESPACE TO ZABBIX;
以下授权需要使用sysdba账号登陆
GRANT SELECT ON V_$LOG_HISTORY TO ZABBIX;
GRANT SELECT ON SYS.DBA_AUDIT_SESSION TO ZABBIX;
GRANT SELECT ON V_$LIBRARYCACHE TO ZABBIX;
GRANT SELECT ON DBA_DATA_FILES TO ZABBIX;
GRANT SELECT ON DBA_TEMP_FILES TO ZABBIX;
GRANT SELECT ON DBA_FREE_SPACE TO ZABBIX;
GRANT SELECT ON V_$SYSTEM_EVENT TO ZABBIX;
GRANT SELECT ON V_$SESSION TO ZABBIX;
exec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description => 'resolve acl', principal =>'ZABBIX', is_grant => true, privilege => 'resolve');
exec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*');
COMMIT;
5、启动orabbix服务、加入开机启动:
/etc/init.d/orabbix start
chkconfig orabbix on
6、查看日志
tail -f /usr/local/orabbix/logs
2018-07-17 11:36:36,662 [pool-1-thread-1] ERROR Orabbix - Error on DBEnquiry on query=archive on database=dbnode1 Error returned is java.lang.IllegalArgumentException: null value for key 'archive'
2018-07-17 11:36:36,664 [pool-1-thread-1] WARN Orabbix - Error while executing ->audit- on database ->dbnode1- Exception received ORA-00942: table or view does not exist
2018-07-17 11:36:36,665 [pool-1-thread-1] WARN Orabbix - Error while executing ->dbblockgets- on database ->dbnode1- Exception received ORA-00942: table or view does not exist
2018-07-17 11:36:36,665 [pool-1-thread-1] ERROR Orabbix - Error on DBEnquiry on query=dbblockgets on database=dbnode1 Error returned is java.lang.IllegalArgumentException: null value for key 'dbblockgets
'
2018-07-17 11:36:36,666 [pool-1-thread-1] WARN Orabbix - Error while executing ->dbconsistentgets- on database ->dbnode1- Exception received ORA-00942: table or view does not exist
2018-07-17 11:36:36,666 [pool-1-thread-1] ERROR Orabbix - Error on DBEnquiry on query=dbconsistentgets on database=dbnode1 Error returned is java.lang.IllegalArgumentException: null value for key 'dbcons
istentgets'
2018-07-17 11:36:36,667 [pool-1-thread-1] WARN Orabbix - Error while executing ->dbhitratio- on database ->dbnode1- Exception received ORA-00942: table or view does not exist
2018-07-17 11:36:36,667 [pool-1-thread-1] ERROR Orabbix - Error on DBEnquiry on query=dbhitratio on database=dbnode1 Error returned is java.lang.IllegalArgumentException: null value for key 'dbhitratio'
2018-07-17 11:36:36,668 [pool-1-thread-1] WARN Orabbix - Error while executing ->dbphysicalread- on database ->dbnode1- Exception received ORA-00942: table or view does not exist
2018-07-17 11:36:36,668 [pool-1-thread-1] ERROR Orabbix - Error on DBEnquiry on query=dbphysicalread on database=dbnode1 Error returned is java.lang.IllegalArgumentException: null value for key 'dbphysic
alread'
2018-07-17 11:36:36,670 [pool-1-thread-1] WARN Orabbix - Error while executing ->dbversion- on database ->dbnode1- Exception received ORA-00942: table or view does not exist
如果有以上类似的报错,基本都是zabbix用户权限不够导致,参考赋权;
正常log如下:
2018-07-20 17:06:16,915 [pool-1-thread-47] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 18537 ms
2018-07-20 17:06:58,428 [pool-1-thread-48] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 48 ms
2018-07-20 17:08:16,967 [pool-1-thread-49] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 18586 ms
2018-07-20 17:08:58,418 [pool-1-thread-50] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 35 ms
2018-07-20 17:10:17,033 [pool-1-thread-51] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 18648 ms
2018-07-20 17:10:58,418 [pool-1-thread-52] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 31 ms
2018-07-20 17:12:17,225 [pool-1-thread-53] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 18836 ms
2018-07-20 17:12:58,426 [pool-1-thread-54] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 35 ms
2018-07-20 17:14:17,013 [pool-1-thread-55] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 18621 ms
2018-07-20 17:14:58,429 [pool-1-thread-56] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 35 ms
2018-07-20 17:16:17,087 [pool-1-thread-57] INFO Orabbix - Done with dbJob on database dbnode1 QueryList elapsed time 18691 ms
/usr/local/orabbix下面有个template目录,里面是zabbix模板,将这些模板copy到本地机器上,然后登陆zabbix,把模板导入进去,就可以配置机器了,zabbix是3.x以上版本的话直接导入不进去,只能先导入2.x版本,然后再导出,然后导入3.x
或者直接用修改后Zabbix3.x可以直接使用的模板
zabbix_oracle_orabbix.zip
导入,并添加对应模板即可,完成以后效果如下:
VIA: http://www.smartmarmot.com/wiki/index.php?title=Orabbix
https://blog.csdn.net/tianhua79658788/article/details/77969426
Tag标签:「性能 zabbix Orabbix」更新时间:「2021-11-03 23:01:57」阅读次数:「943」