orabbix是一个用来监控oracle数据库性能的zabbix插件工具,通过安装在被监控服务器上客户端上收集数据并传给zabbix服务器端,然后通过调用图形显示。具有以下功能:
(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)
#下载地址 http://download.csdn.net/detail/mchdba/9515973 # 解压安装 tar -xvf jdk-8u45-linux-x64.tar.gz -C /usr/lib/jvm |
创建监控用户语句:
CREATEUSER zabbix IDENTIFIEDBY ys_zb_0418 DEFAULTTABLESPACEUSERSTEMPORARYTABLESPACE TEMP PROFILEDEFAULTACCOUNTUNLOCK;
GRANTALTERSESSIONTO zabbix; GRANTCREATESESSIONTO zabbix; GRANTCONNECTTO zabbix; ALTERUSER zabbix DEFAULTROLEALL; GRANTSELECTON V_$INSTANCE TO zabbix; GRANTSELECTON DBA_USERS TO zabbix; GRANTSELECTON V_$LOG_HISTORY TO zabbix; GRANTSELECTON V_$LOG TO zabbix; GRANTSELECTON V_$PARAMETER TO zabbix; GRANTSELECTON SYS.DBA_AUDIT_SESSION TO zabbix; GRANTSELECTON V_$LOCK TO zabbix; GRANTSELECTON DBA_REGISTRY TO zabbix; GRANTSELECTON V_$LIBRARYCACHE TO zabbix; GRANTSELECTON V_$SYSSTAT TO zabbix; GRANTSELECTON V_$PARAMETER TO zabbix; GRANTSELECTON V_$LATCH TO zabbix; GRANTSELECTON V_$PGASTAT TO zabbix; GRANTSELECTON V_$SGASTAT TO zabbix; GRANTSELECTON V_$LIBRARYCACHE TO zabbix; GRANTSELECTON V_$PROCESS TO zabbix; GRANTSELECTON DBA_DATA_FILES TO zabbix; GRANTSELECTON DBA_TEMP_FILES TO zabbix; GRANTSELECTON DBA_FREE_SPACE TO zabbix; GRANTSELECTON V_$SYSTEM_EVENT TO zabbix; GRANTSELECTON V_$locked_object TO zabbix; GRANTSELECTON dba_objects TO zabbix; GRANTSELECTON dba_tablespaces TO zabbix; GRANTSELECTON v_$session TO zabbix; 本blog原始地址为:http://blog.csdn.net/mchdba/article/details/51366790,谢绝转载。 |
如果是oracle11g的数据库版本,还需要执行下面的语句开放ACL的访问控制,否则在监控的过程中有部份内容无法正常显示(例于数据库版本,数据库文件大小等),而且orabbix的日志显示中也会有错误提示。:
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;
# --执行过程 SQL> exec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description=> 'resolve acl', principal =>'ZABBIX', is_grant => true, privilege => 'resolve');
PL/SQLprocedure successfully completed.
SQL> exec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*');
PL/SQLprocedure successfully completed.
SQL> commit;
Commit complete.
SQL>
|
其实orabbix只需要安装在一台服务器即可,我就选择安装在Zabbix Server上,当然上面的jdk是为orabbix服务的,因为orabbix就是一个oracle客户端去查找oracle中的数据,然后传给zabbix,安装orabbix:
# 下载: Mkdir /usr/local/orabbix Cd /usr/local/orabbix wget http://nchc.dl.sourceforge.net/project/orabbix/orabbix-1.2.3.zip # 安装: unzip orabbix-1.2.3.zip chmod +x run.sh cp init.d/orabbix /etc/init.d/ sed -i 's#/opt/orabbix#orabbix=/usr/local/orabbix#g' /etc/init.d/orabbix chmod +x /etc/init.d/orabbix sed -i 's#java#/usr/lib/jvm/jdk1.8.0_45/bin/java#g' /usr/local/orabbix/run.sh |
orabbix所有的配置文件都在conf目录中,需要将默认的配置文件config.props.sample复制一份后再进行修改和配置。
[root@zabbix_serv_121_12 conf]# vim config.props
ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER
#pidFile OrabbixDaemon.PidFile=./logs/orabbix.pid #frequency of item's refresh OrabbixDaemon.Sleep=300 #MaxThreadNumber should be >= than the number of your databases OrabbixDaemon.MaxThreadNumber=100
#put here your databases in a comma separated list # DatabaseList=DB1,DB2,DB3
DatabaseList=azure_yueworldoracle_crm_3_90,azure_earth_dbm1_3_111,DB3
#Configuration of Connection pool #if not specified Orabbis is going to use default values (hardcoded) #Maximum number of active connection inside pool DatabaseList.MaxActive=10 #The maximum number of milliseconds that the pool will wait #(when there are no available connections) for a connection to be returned #before throwing an exception, or <= 0 to wait indefinitely. DatabaseList.MaxWait=100 DatabaseList.MaxIdle=1
#define here your connection string for each database #DB1.Url=jdbc:oracle:thin:@192.167.3.90:1521:DB1 azure_yueworldoracle_crm_3_90.Url=jdbc:oracle:thin:@192.167.3.90:1521:powerdes azure_yueworldoracle_crm_3_90.User=zabbix azure_yueworldoracle_crm_3_90.Password=ys_zb_0418 #Those values are optionals if not specified Orabbix is going to use the general values azure_yueworldoracle_crm_3_90.MaxActive=10 azure_yueworldoracle_crm_3_90.MaxWait=100 azure_yueworldoracle_crm_3_90.MaxIdle=1 azure_yueworldoracle_crm_3_90.QueryListFile=./conf/query.props
azure_earth_dbm1_3_111.Url=jdbc:oracle:thin:@192.167.3.111:1521:earth_m1 azure_earth_dbm1_3_111.User=zabbix azure_earth_dbm1_3_111.Password=ys_zb_0418 azure_earth_dbm1_3_111.QueryListFile=./conf/query.props |
PS:需要注意的是DatabaseList=DB1指的是被监控服务器的名称,该名称要和zabbix server界面中的机器名称保持一致,该配置文件中后续所引用的设定都以该名称为准。
DB1.Url=jdbc:oracle:thin:@ 192.167.3.90:1521:powerdes指定的是被监控服务器的连接信息(例如采用jdbc的联接方式,服务器地址是192.167.3.90,oracle的端口是1521,powerdes指的是数据库的实例名称)
# 启动orabbix [root@zabbix_serv_121_12 conf]# service orabbix start Starting Orabbix service: [root@zabbix_serv_121_12 conf]#
# 查看启动的orabbix进程 [root@zabbix_serv_121_12 conf]# ps aux |grep orabbix root 1259 0.3 0.6 12112256 203324 pts/1 Sl 16:02 0:13 /usr/lib/jvm/jdk1.8.0_45/bin/java -Duser.language=en -Duser.country=US -Dlog4j.configuration=./conf/log4j.properties -cp lib/commons-codec-1.4.jar:lib/commons-dbcp-1.4.jar:lib/commons-lang-2.5.jar:lib/commons-logging-1.1.1.jar:lib/commons-pool-1.5.4.jar:lib/hsqldb.jar:lib/log4j-1.2.15.jar:lib/ojdbc6.jar:.:./orabbix-1.2.3.jar com.smartmarmot.orabbix.bootstrap start ./conf/config.props root 6108 0.0 0.0 103256 844 pts/1 S+ 17:04 0:00 grep orabbix [root@zabbix_serv_121_12 conf]# |
导入模版xml文件,期间碰到问题参加后面的问题记录1。E:\software\Oracle\install_11.2.0.4\pic2\01.png、02.png
在oracle服务器上,加入orabbix监控模版03.png,进入Host -> Templates -> Link new templates -> Select,进去新界面选择Group -> TEMPLATES_ORACLE,之后左边NAME下面打勾,点击Select按钮。
之后点击Link new templates框里的Add按钮,然后点击下面的Update按钮,如04.png所示:
这个oracle模版里面只有oracle的监控,对于oracle服务器的基础监控比如磁盘、io等等是没有的,这个时候我们需要在这个oracle模版上引入linux监控。进入All templates -> Template_Oracle -> Linked templates ->Link new templates选框,点击Select按钮,在进去的界面里面选择Template OS Linux模版,然后退出,点击Add按钮,添加到Linked templates里面,之后点击Update按钮更新完成,可以看到这个oracle模版的items已经增加到108个了,Graphs已经增加到了19个了,Triggers也增加到了390个了,结果如下图E:\software\Oracle\install_11.2.0.4\pic2\05.png所示
从Monitoring -> Graphs -> Group(选择你自己的组) -> Host(选择你自己的oracle服务器) ->Graps,看到oracle服务器的许多监控图列表,如下图E:\software\Oracle\install_11.2.0.4\pic2\06.png所示:
SGA内存使用监控图,E:\software\Oracle\install_11.2.0.4\pic2\07.png:
HitRatio命中率监控图,E:\software\Oracle\install_11.2.0.4\pic2\08.png:
Import failed
Details
· Host group "Templates"already exists.
解决方法:将orabbix的4个xml里面的<group>TEMPLATES</group>改成<group>TEMPLATES_ORACLE</group>,然后重新导入import即可。
参考文章:http://www.smartmarmot.com/wiki/index.php/Orabbix