部署企業級zabbix+Orabbix監控Oracle數據庫

第一章 zabbix+Orabbix

參考: http://www.smartmarmot.com/wiki/index.php?title=Orabbixphp

Orabbix是設計用來爲zabbix監控Oracle數據庫的插件,它提供多層次的監控,包括可用性和服務器性能指標。 它提供了從衆多Oracle實例採集數據的有效機制,進而提供此信息的監控和性能指標。而後,您能夠利用的zabbix的報告功能爲收集的全部數據,並提供分析。目前的發行版中包含了一組預先定義的模板,包括從初始部署警報和圖形功能。然而,這些能夠進行微調,以知足您的需求和數據/監控要求。數據庫

此處輸入圖片的描述

Orabbix能監控什麼?服務器

  • 數據庫版本
  • 歸檔日誌與生產趨勢分析
  • 觸發器,表/過程等命中率
  • 邏輯I / O性能
  • 物理I / O性能
  • PGA
  • SGA
  • 共享池
  • Sessions
  • 數據庫大小

第一步:安裝需求oracle

  • Zabbix 2.2.9 Server * Java Runtime Environment 6 * RHEL5.3 * IP: 0.0.0.58
  • DB Server: * Oracle 11g * IP: 0.0.0.188

第二步:下載Orabbix到Zabbix Server上 http://www.smartmarmot.com/product/orabbix/download/app

On the Zabbix Server( 0.0.0.58)dom

#unzip Orabbix to: /opt/orabbix
[root@hzbacksto orabbix]# pwd
/opt/orabbix
[root@hzbacksto orabbix]# ll orabbix-1.2.3.zip
-rwxr--r-- 1 root root 4858160 Oct 13 06:50 orabbix-1.2.3.zip
[root@hzbacksto orabbix]# unzip orabbix-1.2.3.zip
[root@hzbacksto orabbix]# tree -L 1 ./
./
|-- conf
|-- doc
|-- init.d
|-- install.cmd
|-- lib
|-- logs
|-- orabbix-1.2.3.jar
|-- orabbix-1.2.3.zip
|-- orabbix.exe
|-- orabbixw.exe
|-- run.bat
|-- run.sh
|-- template
|-- uninstall.cmd

#Copy file /opt/orabbix/init.d/orabbix to /etc/init.d/orabbix
[root@hzbacksto orabbix]# cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix

#Grant execute permissions to the following files:
[root@hzbacksto orabbix]# chmod 755 /etc/init.d/orabbix
[root@hzbacksto orabbix]# chmod 755 /opt/orabbix/run.sh

第三步:在須要監控的DB上建立zabbix用戶,使Orabbix來訪問DBide

#On the DB Server( 0.0.0.188)
CREATE TABLESPACE TBS_ZABBIX_01 DATAFILE 
  '/home/oracle/app/oracle/oradata/cha/tbs_zabbix_01.dbf' SIZE 100M AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;

CREATE USER ZABBIX
IDENTIFIED BY pass
DEFAULT TABLESPACE TBS_ZABBIX_01
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;
 
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;

#verify the above is correct by running
select utl_inaddr.get_host_name('127.0.0.1') from dual;

#On the Zabbix Server( 0.0.0.58)
chkconfig --add orabbix
chkconfig --list

第四步:配置文件config.props性能

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

#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1      #此處的ZabbixServer1與如下兩行開頭對應

ZabbixServer1.Address= 0.0.0.58 #zabbixserver地址
ZabbixServer1.Port=10051            #zabbixserver端口

#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=cha                    # 名稱與該機在 zabbix 中監控的主機名稱保持一致

#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
cha.Url=jdbc:oracle:thin:@ 0.0.0.188:1521:cha   #經過jbdc鏈接,確保系統有jdk環境
cha.User=zabbix
cha.Password=pass
#Those values are optionals if not specified Orabbix is going to use the general values
cha.MaxActive=10
cha.MaxWait=100
cha.MaxIdle=1
cha.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

第五步:啓動orabbix程序插件

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

[root@hzbacksto ~]# tail -f /opt/orabbix/logs/orabbix.log
 2015-10-13 03:32:32,773 [main] INFO  Orabbix - maxPoolSize=10
 2015-10-13 03:32:32,773 [main] INFO  Orabbix - maxIdleSize=1
 2015-10-13 03:32:32,773 [main] INFO  Orabbix - maxIdleTime=1800000ms
 2015-10-13 03:32:32,773 [main] INFO  Orabbix - poolTimeout=100
 2015-10-13 03:32:32,773 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-1
 2015-10-13 03:32:32,773 [main] INFO  Orabbix - numTestsPerEvictionRun=3
 2015-10-13 03:32:33,283 [main] INFO  Orabbix - Connected as ZABBIX
 2015-10-13 03:32:33,286 [main] INFO  Orabbix - --------- on Database -> cha
 2015-10-13 03:32:34,344 [pool-1-thread-1] INFO  Orabbix - Done with dbJob on database cha QueryList elapsed time 998 ms

第六步:導入模板設計

將該模板 Orabbix_export_full.xml下載到本機,導入zabbix server template中

[root@hzbacksto template]# pwd
/opt/orabbix/template
[root@hzbacksto template]# ll
total 236
-rw-r--r-- 1 root root 107257 Oct 25  2011 Orabbix_export_full.xml

添加主機(名字必須跟config.props裏面定義的名稱的配置保持一致),因此主機名必須是cha

此處輸入圖片的描述

此處輸入圖片的描述

此處輸入圖片的描述

相關文章
相關標籤/搜索