orabbix監控oracle資料庫狀態例子

來源:互聯網
上載者:User

1 下載

下載地址:
http://www.smartmarmot.com/product/orabbix/download/

2 授予檔案可執行檔許可權

#chmod +x /opt/orabbix -R
#chmod +x /opt/orabbix/run.sh
3 建立一個名為config.props檔案,有模板可以參考。

#cp /opt/orabbix/conf/config.props.sample config.props
下面是我的一個配置:
注意DatabaseList大小寫敏感,並且與zabbix上面的hostname一致。

[root@iZ23snm97y9Z orabbix]# cat conf/config.props
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1

ZabbixServer1.Address=127.0.0.1
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=DB68

#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
DB68.Url=jdbc:oracle:thin:@10.168.xx.xx:1521:test
DB68.User=zabbix
DB68.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
DB68.MaxActive=10
DB68.MaxWait=100
DB68.MaxIdle=1
DB68.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;
 – 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;


用下面的語句來測試:


select utl_inaddr.get_host_name('127.0.0.1') from dual;

5 加入開機自啟動:

chkconfig --add orabbix
1
6 啟動orabbix

/etc/init.d/orabbix start
1
觀察logs/orabbix.log
出現下面的輸出代表orabbix運行正常:

 2015-05-08 10:57:44,343 [pool-1-thread-1] INFO  Orabbix - Done with dbJob on da
tabase DB68 QueryList elapsed time 1125 ms
1
2
否則則要看具體報錯資訊,一般可能是許可權不對等引起連不上資料庫。
orabbix 是通過java程式連oracle,所以需要安裝java環境。

7 zabbix上面匯入xml的模板

在template目錄下面有Orabbix_export_full.xml ,匯入他就ok了。

8 zabbix添加主機

這裡要注意的是不用添加linux的模板,只添加剛剛匯入的oracle模板即可。

9 End

至此,oracle添加完畢,可以用zabbix的圖裡看到oracle的運行狀態。圖就不截了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.