导读:
摘要:一、简介       Orabbix 是设计用来为 zabbix 监控 Oracle 数据库的插件,它提供多层次的监控,包括可用性和服务器性能指标。        它提供了从众多&...
zabbix 监控 oracle 数据库
一、简介
Orabbix 是设计用来为 zabbix 监控 Oracle 数据库的插件,它提供多层次的监控,包括可用性和服务器性能指标。
它提供了从众多 Oracle 实例采集数据的有效机制,进而提供此信息的监控和性能指标。然后,您可以利用的 zabbix 的报告功能为收集的所有数据,并提供分析。目前的发行版中包含了一组预先定义的模板,包括从初始部署警报和图形功能。然而,这些可以进行微调,以满足您的需求和数据/监控要求。
Orabbix 监控什么?
-
数据库版本
-
归档日志与生产趋势分析
-
触发器,表/过程等命中率
-
逻辑 I/O 性能
-
物理 I/O 性能
-
PGA
-
SGA
-
共享池
-
Sessions
-
数据库大小
二、安装配置
# mkdir /opt/orabbix
# cd /opt/orabbix
# unzip orabbix-1.2.3.zip
# mvconf/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.0.180
ZabbixServer.Port=10051
#pidFile
OrabbixDaemon.PidFile=./logs/orabbix.pid
#frequency of item's refresh
OrabbixDaemon.Sleep=300
#MaxThreadNumber should be >= thanthe number of your databases
OrabbixDaemon.MaxThreadNumber=100
#put here your databases in a commaseparated list
DatabaseList=192.168.0.70 # 名称与该机在 zabbix 中监控的主机名称保持一致
#Configuration of Connection pool
#if not specified Orabbis is going touse default values (hardcoded)
#Maximum number of active connectioninside pool
DatabaseList.MaxActive=10
#The maximum number of milliseconds thatthe pool will wait
#(when there are no availableconnections) 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 foreach database
192.168.0.70.Url=jdbc:oracle:thin:@192.168.0.70:32778:southdb # 需要 jdk 环境,因为这里是通过 JDBC 连接的,southdb 为数据库实例名称
192.168.0.70.User=ZABBIX # 用来监控 oracle 数据库的用户名和密码,需要在 oracle 中创建并赋予一定的权限
192.168.0.70.Password=ZABBIX
#Those values are optionals if notspecified Orabbix is going to use the general values
192.168.0.70.MaxActive=10
192.168.0.70.MaxWait=100
192.168.0.70.MaxIdle=1
192.168.0.70.QueryListFile=./conf/query.props
#DB2.Url=jdbc:oracle:thin:@server2.domain.example.com::DB2
#DB2.User=zabbix
#DB2.Password=zabbix_password
#DB2.QueryListFile=./conf/query.props
#DB3.Url=jdbc:oracle:thin:@server3.domain.example.com::DB3
#DB3.User=zabbix
#DB3.Password=zabbix_password
#DB3.QueryListFile=./conf/query.props
关于 jdbc:
Oracle = jdbc:oracle:thin:@::
PostgreSQL = jdbc:postgresql://:/
MS Sql Server = jdbc:jtds:sqlserver://:/
MySQL Server = jdbc:mysql://[host:port],[host:port].../[database]
DB2 = jdbc:db2://:/
四、创建 oracle 监控账户
1、登录 oracle 命令行
su - oracle # 切换到 oracle 用户
sqlplus /nolog # 不连接任何数据库
conn /as sysdba # 用sysdba 登陆
或
conn 用户名/密码
select instance_name from v$instance; # 查看实例
2、创建用户
CREATE USER ZABBIX
IDENTIFIED BY ZABBIX
DEFAULT TABLESPACE SYSTEM
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
3、赋予角色权限
GRANT CONNECT TO ZABBIX;
GRANT RESOURCE TO ZABBIX;
ALTER USER ZABBIX DEFAULT ROLEALL;
4、赋予系统权限
GRANT SELECT ANY TABLE TOZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANT SELECT ANY DICTIONARY TOZABBIX;
GRANT UNLIMITED TABLESPACE TOZABBIX;
GRANT SELECT ANY DICTIONARY TOZABBIX;
五、启动服务
/etc/init.d/orabbix start
或
/opt/orabbix/run.sh
在启动服务过程中通过 tail -f /opt/orabbix/logs/orabbix.log日志查看报错信息。
六、zabbix
server 端配置
将该模板 Orabbix_export_full.xml 下载到本机,差导入 zabbix
server template
# sz orabbix/template/Orabbix_export_full.xml

将模板绑定到要监控的主机上:


附:官方文档
http://www.smartmarmot.com/wiki/index.php/Orabbix
Assumptions
Theinstallation instructions have been created based on instructions for most *nixdeployments (i.e. RHEL/CentOS), and is assumed that any alterations requiredfor your specific environment are
to be taken into account accordingly.
Thisguide is based upon there being two (2) Hosts, 1x Zabbix Server and 1x OracleServer. If you are planning on monitoring an Oracle instance that is running onyour Zabbix Server, the steps are
the same, with minor adjustments required foryour connection information.
Thesteps also assume you are configuring Orabbix to monitor a new installation orsetup of Oracle. The installation steps will have you GRANT access for theZabbix user to all tables, and this will
include any USER tables present at thetime of execution. If you do not want Zabbix to have access to specific tablesor resources within your database, you will need to set a DENY to the Zabbixusers access as required. Consult your DBA for details, as this
is beyond thescope of these instructions.
Stepsfor Installation
-
Download Orabbix to your Zabbix Server
-
On your Zabbix server, unzip Orabbix to: /opt/orabbix
-
Copy file /opt/orabbix/init.d/orabbix to /etc/init.d/orabbix
-
Grant execute permissions to the following files:
/etc/init.d/orabbix
/opt/orabbix/run.sh
CREATE USER ZABBIX
IDENTIFIED BY ZABBIX
DEFAULT TABLESPACE SYSTEM
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;
zabbix 监控 oracle 数据库