zabbix利用orabbix监控oracle

下载、压缩orabbix软件包

# mkdir -p /opt/orabix
# unzip orabbix-1.2.3.zip  -d /opt/orabbix/
# chmod -R a+x /opt/orabbix
# cp conf/config.props.sample conf/config.props
# cp init.d/orabbix /etc/init.d/
# chmod 755 /etc/init.d/orabbix 
# chkconfig orabbix on

编辑orabbix的配置文件

# vim conf/config.props
以下为修改的内容:
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer
ZabbixServer.Address=192.168.56.180
ZabbixServer.Port=10051
DatabaseList=192.168.56.70   # 名称与该机在 zabbix 中监控的主机名称保持一致
#define here your connection string foreach database
192.168.56.70.Url=jdbc:oracle:thin:@192.168.56.70:1543:sdb # 需要 jdk 环境,因为这里是通过 JDBC 连接的,sdb 为数据库实例名称
192.168.56.70.User=ZABBIX # 用来监控 oracle 数据库的用户名和密码,需要在 oracle 中创建并赋予一定的权限
192.168.56.70.Password=ZABBIX
#Those values are optionals
if notspecified Orabbix is going to use the general values
192.168.56.70.MaxActive=10 192.168.56.70.MaxWait=100 192.168.56.70.MaxIdle=1 192.168.56.70.QueryListFile=./conf/query.props

关于 jdbc:

 Oracle        =       jdbc:oracle:thin:@<host>:<LISTENER_PORT>:<instance>
 PostgreSQL    =       jdbc:postgresql://<host>:<port>/<database>
 MS Sql Server =       jdbc:jtds:sqlserver://<host>:<port>/<instancename>
 MySQL Server  =       jdbc:mysql://[host:port],[host:port].../[database]
 DB2           =       jdbc:db2://<servername>:<port>/<installatio

创建数据库表空间

create tablespace zabbix datafile 
  '+data' size 200m autoextend on next 30m maxsize 1g;

创建数据库用户

create user zabbix
 identified by zabbix
 default tablespace zabbix
 temporary tablespace temp
 profile default
 account unlock;
 – 2 roles for zabbix
 grant connect to zabbix;
 grant resource to zabbix;
 alter user zabbix default role all;
 – 5 system privileges for zabbix
 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;

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服务

# /etc/init.d/orabbix start
Starting Orabbix service:

现在去zabbix的WEB页面导入ORACLE的监测模板
在orabbix目录的template内,只要在configuration-->host-->Import-->Template,然后选择Orabbix_export_full.xml文件,目录为解压目录下的 orabbix/template/Orabbix_export_full.xml
 
添加oracle主机
在configuration-->Templates-->Hosts中添加Oracle主机,Name要等于在config.props中设的名字,另外,要将此机器加入到Template Oracle中

原文地址:https://www.cnblogs.com/abclife/p/4763646.html