zabbix3和orabbix的安裝與配置
環境
zabbix版本:3
OS版本:redhat 7.4
orabbix :1.2.3
zabbix的安裝,參考文件:
https://www.zabbix.com/download?zabbix=3.0&os_distribution=rhel&os_version=7&db=MySQL
https://www.zabbix.com/documentation/3.4/zh/manual/installation/install_from_packages
安裝zabbix的repository
# rpm -i https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
安裝zabbix server,frontend,agent
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
建立database,這裡使用的是msql,那種解壓後,初始化就可以用的mysql
mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to [email protected] identified by 'oracle'; mysql> quit;
匯入mysql要使用的表等資訊
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
編輯zabbix server上的資料庫配置。就是上面建立mysql資料庫的一些資訊
# vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix DBSocket=/var/lib/mysql/mysql.sock -- 注意這裡,之前沒有配置這裡,發現web上配置zabbix的時候,提示sock導致無法連線mysql
編輯zabbix前段的php配置。大部分引數預設已經配置好了,主要是時區。
vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
啟動zabbix服務
# systemctl restart zabbix-server zabbix-agent httpd
到這裡,zabbix就配置完畢了。可以通過http://ip/zabbix 來訪問 。預設的賬號是Admin/zabbix
安裝zabbix碰到的一些問題,主要是yum源的問題,因為安裝zabbix會以來一些包,比如OpenIPMI-libs、fping 、iksemel 、unixODBC 、zabbix-web 。建議使用centos來安裝,因為centos的yum源比較豐富。或者把源更改為centos的源。本次安裝時在redhat7.4下安裝,更改成了centos的yum源。
orabbix的安裝與配置
orabbix的參考文件
http://www.smartmarmot.com/wiki/index.php?title=Orabbix#Download_.26_Installation_Instructions
安裝Oracle並建立表空間,使用者,授權,我這裡做測試,直接授權dba了。
Oracle的資訊
IP:192.168.2.101
ORACLE SID:test
伺服器名稱:zabbix
CREATE USER zabbix IDENTIFIED BY oracle DEFAULT TABLESPACE zabbix 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;
下載orabbix到zabbix server上。
解壓orabbix到/opt/orabbix
copy /opt/orabbix/init.d/orabbix到/etc/init.d/orabbix
授予執行許可權給/etc/init.d/orabbix ,/opt/orabbix/run.sh
unzip -q orabbix-1.2.3.zip -d /opt/orabbix/
cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
chmod +x /etc/init.d/orabbix
chomd +x /opt/orabbix/run.sh
11g的db需要在資料庫上執行以下語句,否則處於安全原因是無法連線oracle庫的
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的配置
[[email protected] conf]# more config.props
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1
ZabbixServer1.Address=192.168.2.101
ZabbixServer1.Port=10051
#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=test
#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
test.Url=jdbc:oracle:thin:@192.168.2.101:1521:test
test.User=zabbix
test.Password=oracle
#Those values are optionals if not specified Orabbix is going to use the general
values
test.MaxActive=10
test.MaxWait=100
test.MaxIdle=1
test.QueryListFile=./conf/query.props
到此,orabbix的配置完成,啟動orabbix,在zabbix介面上新增相關的模板後,就可以看到Oracle相關的監控了。
之前使用的是zabbix4,安裝orabbix,因為版本相容問題,導致無法獲取監控oracle的語句。
出現的一些問題:Orabbix-received unexpected response '' for key 'XX'. 原因,zabbix4 上無法使用orabbix1.2.3. 更改zabbix3後,問題解決。
end