记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。
Orabbix 是一个用来监控 Oracle 数据库实例的 Zabbix 插件。下载地址:

http://www.smartmarmot.com/product/orabbix/download/

 

 Orabbix插件的安装与配置

 确保安装jdk环境,java version查看,没有则通过yum来安装JAVAyum install java

 

 1./opt目录下新建一个orabbix目录:

 [root@oracle orabbix]#midir -p /opt/orabbix

(建议在此目录下,如果放置其他目录稍后需要更改orabbix的启动文件orabbix,启动文件默认写在opt/orabbix目录下 

 

 2. 解压安装文件

[root@oracle orabbix]#unzip orabbix-1.2.3.zip

 

3.赋予权限

 [root@oracle orabbix]# chmod -R a+x orabbix/

 

通过/opt/orabbix/conf/config.props.sample文件创建一个config.props文件

 

 [root@oracle orabbix]#cp/opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props

  

5.  编辑orabbix配置文件,具体如下

 [root@oracle orabbix]#vi confi/config.props

 

#comma separed list of Zabbix servers

#ZabbixServerList=ZabbixServer1,ZabbixServer2

ZabbixServerList=ZabbixServer1  

#(zabbixserver的名字下行中addressport都引用到了这个名字所以下面两行的前缀名字要与这里的名字保持一致)

 

#ZabbixServer1.Address=IP_ADDRESS_OF_ZABBIX_SERVER

ZabbixServer1.Address=192.168.3.163

#ZabbixServer1.Port=PORT_OF_ZABBIX_SERVER

ZabbixServer1.Port=10051

 

#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER

#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=DB_QM    DB名称可随意定义但要与下文保持一致切记要与监控的主机名称保持一致

 

#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:@server.domain.example.com:<LISTENER_PORT>:DB1

DB_QM.Url=jdbc:oracle:thin:@192.168.3.250:1521:qmeas

#确保有jdk环境,因为这里是通过JDBC连接的

#DB1.User=zabbix

DB_QM.User=qm

#DB1.Password=zabbix_password

DB_QM.Password=qm

#DB的用户和密码,可创建zabbix用户,并赋予权限,如下文(这里直接用dba权限用户)

#Those values are optionals if not specified Orabbix is going to use the general values

DB_QM.MaxActive=10

DB_QM.MaxWait=100

DB_QM.MaxIdle=1

DB_QM.QueryListFile=./conf/query.props

 

#DB2.Url=jdbc:oracle:thin:@server2.domain.example.com:<LISTENER_PORT>:DB2

#DB2.User=zabbix

#DB2.Password=zabbix_password

#DB2.QueryListFile=./conf/query.props

 

#DB3.Url=jdbc:oracle:thin:@server3.domain.example.com:<LISTENER_PORT>:DB3

#DB3.User=zabbix

#DB3.Password=zabbix_password

#DB3.QueryListFile=./conf/query.props

#注销未用到的DB连接

 

 

创建zabbix用户如下步骤

CREATE USER ZABBIX

     IDENTIFIEDBY zabbix     <Password>

     DEFAULTTABLESPACE SYSTEM

     TEMPORARYTABLESPACE TEMP

     PROFILEDEFAULT

     ACCOUNTUNLOCK;

     GRANT CONNECT TO ZABBIX;

     GRANTRESOURCE TO ZABBIX;

     ALTERUSER ZABBIX DEFAULT ROLE ALL;

     GRANT SELECT ANY TABLE TO ZABBIX;

     GRANT CREATE SESSION TO ZABBIX;

     GRANTSELECT ANY DICTIONARY TO ZABBIX;

     GRANTUNLIMITED TABLESPACE TO ZABBIX;

     GRANTSELECT ANY DICTIONARY TO ZABBIX;

 

Oracle 11g添加如下命令

execdbms_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;

 

 6.  创建执行文件(直接cp即可)

 [root@oracle orabbix]# cp /opt/orabbix/init.d/orabbix/etc/init.d/orabbix

7.保存退出启动orabbix服务(确保有执行权限)

/etc/init.d/orabbix start

Orabbix服务加入随系统启动

chkconfig --add orabbix

chkconfig --level 345 orabbix on

 

 常见问题:

config.props文件未配置,或是配置了错误,无法通过配置的信息正确连进Oracle数据库的,会出现以下错误信息

[root@zabbix orabbix]# /etc/init.d/orabbix start

 

Starting Orabbix service:

[root@zabbix orabbix]# Stopping

java.lang.Exception: ERROR on main - Connections is empty

     atcom.smartmarmot.orabbix.Orabbixmon.run(Orabbixmon.java:101)

     atcom.smartmarmot.orabbix.bootstrap.main(bootstrap.java:50)

 

可查看log信息判断解决

[root@oracle orabbix]# tail -f /opt/orabbix/logs/orabbix.log

 

到此,安装配置完成,则通过web页面访问直接导入模块即可

 

2012年09月10日 - herb - herb

 导入模版,模版放置在/opt/orabbix/template下
Orabbix_export_full.xml         全部导入(图表 监控项 触发器)
Orabbix_export_graphs.xml    图表
Orabbix_export_items.xml      监控项
Orabbix_export_triggers.xml   触发器

选中Orabbix_export_full.xml直接导入,则可以直接在主机中链接到模版就可以使用全部功能了(主机名称一定要与配置中的 DatabaseList=DB_QM保持一致)!

2012年09月10日 - herb - herb

 也可以再模版中找到此模版。然后将需要的信息直接cp过去,比如打开此处的监控项,把它全部复制到oracle主机下,触发器、图像显示同理!

2012年09月10日 - herb - herb

 创建图表,部分效果如下:

2012年09月10日 - herb - herb




Orabbix无法获取Oracle DB Size和DB Files Size的解决方法

这几天在研究Orabbix时发现在Zabbix中无法获取DB Size和DB Files Size的大小,,后来发现问题出在/opt/orabbix/conf/query.props文件的配置上:

因为最新的Orabbix 1.2.3版本在解压安装后,默认的query.props文件内没有配置这两个选项的检测,所以需要手动加上,分别在此文件中两个地方加入配置,具体如下:

1. 在“QueryList=”的最后加上“,dbfilesize,dbsize”,注意要用逗号格开;

2. 另外加上,dbfilesize,dbsize的检测语句,如下:

dbfilesize.Query=select to_char(sum(bytes/1024/1024/10), 'FM99999999999999990') retvalue from dba_data_files

dbsize.Query=SELECT to_char(sum(  NVL(a.bytes/1024/1024/10 - NVL(f.bytes/1024/1024/10, 0), 0)), 'FM99999999999999990') retvalue \
FROM sys.dba_tablespaces d, \
(select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name) a, \
(select tablespace_name, sum(bytes) bytes from dba_free_space group by tablespace_name) f \
WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+) \
AND NOT (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY')


休改后结果如下:

QueryList=archive,audit,dbblockgets,dbconsistentgets,dbhitratio,dbphysicalread,dbversion,hitratio_body,hitratio_sqlarea,hitratio_table_proc, \
lio_current_read,locks,maxprocs,maxsession,miss_latch,pga_aggregate_target, pga,phio_datafile_reads,phio_datafile_writes,phio_redo_writes,pinhitratio_body,pinhitratio_sqlarea,pinhitratio_table-proc,pinhitratio_trigger, \pool_dict_cache,pool_free_mem,pool_lib_cache,pool_misc,pool_sql_area,procnum,session_active,session_inactive,session,session_system,sga_buffer_cache, \ sga_fixed,sga_java_pool,sga_large_pool,sga_log_buffer,sga_shared_pool,tbl_space,userconn,waits_controfileio,waits_directpath_read, \ waits_file_io,waits_latch,waits_logwrite,waits_multiblock_read,waits_singleblock_read,hitratio_trigger,lio_block_changes,lio_consistent_read,waits_other,

waits_sqlnet,users_locked,uptime,dbfilesize,dbsize


DataGuardPrimaryQueryList=dg_error,dg_sequence_number
DataGuardStandbyQueryList=dg_sequence_number_stby
RmanQueryList=rman_check_status

dbfilesize.Query=select to_char(sum(bytes/1024/1024/10), 'FM99999999999999990') retvalue from dba_data_files

dbsize.Query=SELECT to_char(sum(  NVL(a.bytes/1024/1024/10 - NVL(f.bytes/1024/1024/10, 0), 0)), 'FM99999999999999990') retvalue \
FROM sys.dba_tablespaces d, \
(select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name) a, \
(select tablespace_name, sum(bytes) bytes from dba_free_space group by tablespace_name) f \
WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+) \
AND NOT (d.extent_management like 'LOCAL' AND d.contents like 'TEMPORARY')




转载请标明出处【zabbix利用orabbix监控oracle 】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论