標籤:query roo win daemon config orabbix chm com each
Orabbix 是一個用來監控 Oracle 資料庫執行個體的 Zabbix 外掛程式。:
http://www.smartmarmot.com/product/orabbix/download/
Orabbix外掛程式的安裝與配置
確保安裝jdk環境,java version查看,沒有則通過yum來安裝JAVA:yum install java
1.在/opt目錄下建立一個orabbix目錄:
[[email protected] orabbix]#midir -p /opt/orabbix
(建議在此目錄下,如果放置其他目錄稍後需要更改orabbix的開機檔案orabbix,開機檔案預設寫在opt/orabbix目錄下 )
2. 解壓安裝檔案
[[email protected] orabbix]#unzip orabbix-1.2.3.zip
3.賦予許可權
[[email protected] orabbix]# chmod -R a+x orabbix/
4 通過/opt/orabbix/conf/config.props.sample檔案建立一個config.props檔案:
[[email protected] orabbix]#cp/opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props
5. 編輯orabbix設定檔,具體如下
[[email protected] orabbix]#vi confi/config.props
#comma separed list of Zabbix servers#ZabbixServerList=ZabbixServer1,ZabbixServer2ZabbixServerList=ZabbixServer1 #(zabbixserver的名字,下行中address和port都引用到了這個名字,所以下面兩行的首碼名字要與這裡的名字保持一致)#ZabbixServer1.Address=IP_ADDRESS_OF_ZABBIX_SERVERZabbixServer1.Address=192.168.3.163#ZabbixServer1.Port=PORT_OF_ZABBIX_SERVERZabbixServer1.Port=10051#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER#pidFileOrabbixDaemon.PidFile=./logs/orabbix.pid#frequency of item‘s refreshOrabbixDaemon.Sleep=300#MaxThreadNumber should be >= than the number of your databasesOrabbixDaemon.MaxThreadNumber=100#put here your databases in a comma separated list#DatabaseList=DB1,DB2,DB3DatabaseList=DB_QM (DB名稱,可隨意定義,但要與下文保持一致,切記要與監控的主機名稱保持一致)#Configuration of Connection pool#if not specified Orabbis is going to use default values (hardcoded)#Maximum number of active connection inside poolDatabaseList.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=100DatabaseList.MaxIdle=1#define here your connection string for each database#DB1.Url=jdbc:oracle:thin:@server.domain.example.com:<LISTENER_PORT>:DB1DB_QM.Url=jdbc:oracle:thin:@192.168.3.250:1521:qmeas#確保有jdk環境,因為這裡是通過JDBC串連的#DB1.User=zabbixDB_QM.User=qm#DB1.Password=zabbix_passwordDB_QM.Password=qm#DB的使用者和密碼,可建立zabbix使用者,並賦予許可權,如下文(這裡直接用dba許可權使用者)#Those values are optionals if not specified Orabbix is going to use the general valuesDB_QM.MaxActive=10DB_QM.MaxWait=100DB_QM.MaxIdle=1DB_QM.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#注釋未用到的DB串連
建立zabbix使用者如下步驟:
CREATE USER ZABBIX
IDENTIFIEDBY zabbix <Password>
DEFAULTTABLESPACE SYSTEM
TEMPORARYTABLESPACE TEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
GRANT CONNECT TO ZABBIX;
GRANTRESOURCE TO ZABBIX;
ALTERUSER ZABBIX DEFAULT ROLE ALL;
GRANT SELECT ANY TABLE TO ZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANTSELECT ANY DICTIONARY TO ZABBIX;
GRANTUNLIMITED TABLESPACE TO ZABBIX;
GRANTSELECT ANY DICTIONARY TO ZABBIX;。
Oracle 11g添加如下命令
execdbms_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;
6. 建立執行檔案(直接cp即可)
[[email protected] orabbix]# cp /opt/orabbix/init.d/orabbix/etc/init.d/orabbix
7.儲存退出,啟動orabbix服務(確保有執行許可權)
/etc/init.d/orabbix start
Orabbix服務加入隨系統啟動:
chkconfig --add orabbix
chkconfig --level 345 orabbix on
常見問題:
若config.props檔案未配置,或是配置了錯誤,無法通過配置的資訊正確連進Oracle資料庫的,會出現以下錯誤資訊
[[email protected] orabbix]# /etc/init.d/orabbix start
Starting Orabbix service:
[[email protected] orabbix]# Stopping
java.lang.Exception: ERROR on main - Connections is empty
atcom.smartmarmot.orabbix.Orabbixmon.run(Orabbixmon.java:101)
atcom.smartmarmot.orabbix.bootstrap.main(bootstrap.java:50)
可查看log資訊判斷解決
[[email protected] orabbix]# tail -f /opt/orabbix/logs/orabbix.log
到此,安裝配置完成,則通過web頁面訪問直接匯入模組即可
匯入模版,模版放置在/opt/orabbix/template下
Orabbix_export_full.xml 全部匯入(圖表 監控項 觸發器)
Orabbix_export_graphs.xml 圖表
Orabbix_export_items.xml 監控項
Orabbix_export_triggers.xml 觸發器
選中Orabbix_export_full.xml直接匯入,則可以直接在主機中連結到模版就可以使用全部功能了(主機名稱一定要與配置中的 DatabaseList=DB_QM保持一致)!
也可以再模版中找到此模版。然後將需要的資訊直接cp過去,比如開啟此處的監控項,把它全部複製到oracle主機下,觸發器、映像顯示同理!
建立圖表,部分效果如下:
orabbix監控oracle