zabbix3和orabbix的安装与配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xxzhaobb/article/details/85223386

环境

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 zabbix@localhost 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的配置

[root@zabbix 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

猜你喜欢

转载自blog.csdn.net/xxzhaobb/article/details/85223386
今日推荐