亲测的orabbix监控Oracle过程

Posted ld1977

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了亲测的orabbix监控Oracle过程相关的知识,希望对你有一定的参考价值。

     网上教程很多,但普遍较老,担心新版本的变化,于是亲自测试了一下,记录过程如下:

  一、环境

   Centos7.3 192.168.56.104

   Oracle安装在windows下,192.168.56.101

 二、步骤:

   1.确保JRE环境,使用java命令可以识别

   如果没有可以直接Yum install java java-devel

   2.安装orabbix

   orabbix官网:http://www.smartmarmot.com/wiki/index.php?title=Orabbix

   下载地址:http://www.smartmarmot.com/product/orabbix/download/  最新版本orabbix-1.2.3.zip

   下载后上传到Zabbix-server的/opt/orabbix/下(建议目录,否则会影响后续脚本执行)

#mkdir /opt/orabbix
#cd /opt/orabbit
#unzip orabbix-1.2.3.zip

 解压后的目录如图:

3. 配置orabbix

给orabbix目录下附权限

#chmod a+x /opt/orabbix -R

创建orabbix配置文件

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

编辑config.props

[root@zabbix ~]# cat /opt/orabbix/conf/config.props

#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer 
ZabbixServer.Address=192.168.56.104     #Zabbix server的地址 端口
zabbixServer.Port=10051

#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER
#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER

#pidFile
OrabbixDaemon.PidFile=./logs/orabbix.pid       #Java进程
#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=win-oracle         #此处名称需和oracle db端zabbix前端的hostname⼀一致

#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
win-oracle.Url=jdbc:oracle:thin:@192.168.56.101:1521:orcl  #实例名为orcl
#DB1.User=ZABBIX
win-oracle.User=zabbix
#DB1.Password=zabbix_password
win-oracle.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
win-oracle.MaxActive=10
win-oracle.MaxWait=100
win-oracle.MaxIdle=1
win-oracle.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

4.在Oracle端增加用户和权限

CREATE USER ZABBIX IDENTIFIED BY zabbix DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
GRANT CONNECT TO ZABBIX;
GRANT RESOURCE TO ZABBIX;
ALTER USER ZABBIX DEFAULT ROLE ALL;
GRANT SELECT ANY TABLE TO ZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;
GRANT UNLIMITED TABLESPACE TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;


GRANT ALTER SESSION TO zabbix;
GRANT CREATE SESSION TO zabbix;
GRANT CONNECT 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_$LOG 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_$PARAMETER 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 ON V_$locked_object TO zabbix;
GRANT SELECT ON dba_objects TO zabbix;
GRANT SELECT ON dba_tablespaces TO zabbix;
GRANT SELECT ON v_$session TO zabbix;

上面的有重复的,不同文档中的,我当时发现一个文档的权限似乎不全,所以综合了两个文档。

都说11G还需要执行以下过程,11G以前的版本没试过,不知道是否要执行:

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的服务和进程

#cp -a /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
#chmod 755 /etc/init.d/orabbix
#/etc/init.d/orabbix start

⽇日志⽂文件在/opt/orabbix/logs/orabbix.log中 tail -f 跟踪⽇日志分析部署过程中的问题。

三、前端增加主机

然后再zabbix web端configuration—》Templates—》Import中将模板添加
然后再已添加好的hosts中增加该oracle template,enable相应所需要监控的内容即可。

 

  

  

  

  

  

  

 

以上是关于亲测的orabbix监控Oracle过程的主要内容,如果未能解决你的问题,请参考以下文章

orabbix插件监控oracle表空间问题

orabbix监控oracle

zabbix利用orabbix监控oracle

zabbix利用orabbix监控oracle

zabbix之 orabbix模板监控oracle

Orabbix 监控oracle表空间 Low Level Discovery