一、Orabbix简介
Orabbix是设计用来为zabbix监控Oracle的数据库的插件,它提供多层次的监控,包括可用性和服务器性能的指标。
它提供了从众多Oracle实例采集的有效机制,进而提供此信息的监控和性能指标。然后,您可以利用的zabbix的报告功能为收集的所有数据,并提供分析。目前的发行版中包含了一组预先定义的模板,包括从初始部署报警和图形功能。然而,这些可以进行微调,以满足您额需求和数据/监控要求。
二、Orabbix监控的内容
1、数据库版本
2、归档日志与生产趋势
3、触发器,表/过程命中率
4、逻辑IO性能
5、物理IO性能
6、PGA
7、SGA
8、共享池
9、Session
10、数据库大小
三、服务端操作:
1、安装jre。(确保有Java的环境)
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/
# rpm -ivh jre-7u67-linux-x64.rpm Preparing... ########################################### [100%] 1:jre ########################################### [100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... localedata.jar... jfxrt.jar... |
2、安装orabbix (一般选择安装在zabbix server端,如果安装在其他地方也可以)
下载地址:http://www.smartmarmot.com/product/orabbix/download/
1)在/opt创建目录创建orabbix文件。(原因:orabbix启动文件默认写在/opt/orabbix目录下,也可以修改一下orabbix启动脚本的路径 )
#mkdir /opt/orabbix #mv orabbix-1.2.3.zip /opt/orabbix #cd /opt/orabbit #unzip orabbix-1.2.3.zip |
2)授予文件可执行的权限
#chmod a+x /opt/orabbix -R |
3)创建一个名为config.props文件,有模板可以参考。
#cp /opt/orabbix/conf/config.props.sample config.props |
4)修改confi.props配置文件,仅需修改如下内容即可。
参数说明: # cat /opt/orabbix/conf/config.props |grep -v "#" 这里仅取没有注释的。 ZabbixServerList=ZabbixServer #zabbix名称
ZabbixServer.Address=192.168.0.119 #zabbix服务端的IP地址 ZabbixServer.Port=10051 #zabbix服务端的端口
OrabbixDaemon.PidFile=./logs/orabbix.pid OrabbixDaemon.Sleep=300 OrabbixDaemon.MaxThreadNumber=100
DatabaseList=twstcptest.com #这个名称可以随便起,但是必须跟监控的主机名保持一致。
DatabaseList.MaxActive=10 DatabaseList.MaxWait=100 DatabaseList.MaxIdle=1
twstcptest.com.Url=jdbc:oracle:thin:@192.168.0.110:1521:rdcms #这里主要是通过JDBC来连接客户端的。rdcms主要是数据库的实例名称。在客户端可以通过select instance_name from v$instance来得到实例的名称。 twstcptest.com.User=zabbix #数据库用户 twstcptest.com.Password=zabbix #数据库用户密码 twstcptest.com.MaxActive=10 twstcptest.com.MaxWait=100 twstcptest.com.MaxIdle=1 twstcptest.com.QueryListFile=./conf/query.props
配置参考 ###】cat config.props #comma separed list of Zabbix servers ZabbixServerList=ZabbixServer1 ZabbixServer1.Address=192.168.50.34 ZabbixServer1.Port=10051 #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=Yueqing7 #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 Yueqing7.Url=jdbc:oracle:thin:@192.168.20.2:1521:boncdev Yueqing7.User=bmonitor Yueqing7.Password=bmonitor Yueqing7.QueryListFile=./conf/query.props |
四、客户端操作: 登录数据库并授予用户相关权限即可
1.新建用户:
-Create a User for Orabbix to access your Oracle Database. You can use the following script:
SQL> CREATE TABLESPACE TBS_bmonitor DATAFILE '/oradata01/boncdev/oradata/BONCDEV/datafile/tbs_bmonitor_1g_01.dbf' SIZE 1024M AUTOEXTEND OFF; SQL> CREATE USER bmonitor IDENTIFIED BY bmonitor DEFAULT TABLESPACE tbs_bmonitor TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK; |
2.基本权限授权
-Roles for bmonitor
SQL> GRANT CONNECT TO bmonitor; SQL> GRANT RESOURCE TO bmonitor; SQL> ALTER USER bmonitor DEFAULT ROLE ALL; |
3.粗粒度授权
-5 System Privileges for BMONITOR
SQL> GRANT SELECT ANY TABLE TO BMONITOR; SQL> GRANT CREATE SESSION TO BMONITOR; SQL> GRANT SELECT ANY DICTIONARY TO BMONITOR; SQL> GRANT UNLIMITED TABLESPACE TO BMONITOR; SQL> GRANT SELECT ANY DICTIONARY TO BMONITOR; |
4.细粒度授权
SQL> GRANT SELECT ON V_$INSTANCE TO bmonitor; SQL> GRANT SELECT ON DBA_USERS TO bmonitor; SQL> GRANT SELECT ON V_$LOG_HISTORY TO bmonitor; SQL> GRANT SELECT ON V_$PARAMETER TO bmonitor; SQL> GRANT SELECT ON SYS.DBA_AUDIT_SESSION TO bmonitor; SQL> GRANT SELECT ON V_$LOCK TO bmonitor; SQL> GRANT SELECT ON DBA_REGISTRY TO bmonitor; SQL> GRANT SELECT ON V_$LIBRARYCACHE TO bmonitor; SQL> GRANT SELECT ON V_$SYSSTAT TO bmonitor; SQL> GRANT SELECT ON V_$PARAMETER TO bmonitor; SQL> GRANT SELECT ON V_$LATCH TO bmonitor; SQL> GRANT SELECT ON V_$PGASTAT TO bmonitor; SQL> GRANT SELECT ON V_$SGASTAT TO bmonitor; SQL> GRANT SELECT ON V_$LIBRARYCACHE TO bmonitor; SQL> GRANT SELECT ON V_$PROCESS TO bmonitor; SQL> GRANT SELECT ON DBA_DATA_FILES TO bmonitor; SQL> GRANT SELECT ON DBA_TEMP_FILES TO bmonitor; SQL> GRANT SELECT ON DBA_FREE_SPACE TO bmonitor; SQL> GRANT SELECT ON V_$SYSTEM_EVENT TO bmonitor; SQL> GRANT SELECT ON v_$log TO bmonitor; SQL> GRANT SELECT ON v_$locked_object TO bmonitor; SQL> GRANT SELECT ON v_$session TO bmonitor; SQL> GRANT SELECT ON dba_tablespaces TO bmonitor; SQL> GRANT SELECT ON dba_objects TO bmonitor; SQL> GRANT SELECT ON v_$archived_log to bmonitor; SQL> GRANT SELECT ON V_$SGA to bmonitor; |
5.
如果是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;
五、模板导入 (监控模板文件 Orabbix_export_full.xml 在orabbix.zip压缩包 template 目录内)
1)创建 Host groups
2)导入模版xml文件 Configuration > Templates > Import file (选择orabbix自带模板导入)> Import
3) 创建 HOSTS,并关联oracle监控模板
创建 hosts (注意 Host name 要与 /opt/orabbix/conf/config.props 文件配置一致。
关联oracle监控模板 :Host -> Templates -> Link new templates -> Select
六、 监控效果
问题1:
ORA-28040: No matching authentication protocol错误,低客户端连接到12c高版本的解决方案
解决:在Oracle用户(不是grid用户)下,将$ORACLE_HOME/network/admin/sqlnet.ora文件原来的SQLNET.ALLOWED_LOGON_VERSION=8注释掉(如果没有sqlnet.ora文件,那么就创建一个),修改为如下的行:
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
不用重启数据库或者监听,也不用重启应用。
问题2:
Import failed
Details
· Host group "Templates"already exists.
解决方法:将orabbix的4个xml里面的<group>TEMPLATES</group>改成
<group>TEMPLATES_ORACLE</group>,然后重新导入import即可。
问题3:
cannot send list of active checks to "192.168.1.99": host [192.168.1.99] not found
web前端 hosts name 跟 配置文件内不一致