依据Oracle安装Zabbix

 

软件版本

Oracle Enterprise Linux 7.1 64bit

Oracle Enterprise Edition 12.1.0.2 64bit

Zabbix 3.2.1

准备干活

上传软件

咱们选用Zabbix 3.2.1

解压路径为/u01/stage/zabbix-3.2.1

备得之软件
安装Oracle 12.1.0.2

安装和开创数据库过程略,数据库字符集注意得要是是UTF8或AL32UTF8。

Apache

Zabbix的frontend需要apache
,我们应用OL7.1起带的http服务,应该是apache2.4

PHP 及另外扩展

的互关包的具体要求,参见:https://www.zabbix.com/documentation/3.2/manual/installation/requirements

顾PHP一定要是5.4之上的,因为OL7.1于带的PHP已经是5.4了,所以省去了PHP安装之历程。

切切实实装的软件包:

#rpm -Uvh php-5.4.16-23.el7_0.3.x86_64.rpm
php-cli-5.4.16-23.el7_0.3.x86_64.rpm
php-common-5.4.16-23.el7_0.3.x86_64.rpm
libzip-0.10.1-8.el7.x86_64.rpm

#rpm -Uvh php-gd-5.4.16-23.el7_0.3.x86_64.rpm
t1lib-5.1.2-14.el7.x86_64.rpm

#rpm -Uvh libxml2-2.9.1-5.0.1.el7_0.1.x86_64.rpm

#rpm –Uvh libxml2-devel-2.9.1-5.0.1.el7_0.1.x86_64.rpm
xz-devel-5.1.2-9alpha.el7.x86_64.rpm
zlib-devel-1.2.7-13.el7.x86_64.rpm

#rpm -Uvh php-xml-5.4.16-23.el7_0.3.x86_64.rpm

#rpm -Uvh php-xmlrpc-5.4.16-23.el7_0.3.x86_64.rpm

(ftp://bo.mirror.garr.it/1/slc/centos/7.0.1406/updates/x86_64/Packages/php-mbstring-5.4.16-23.el7_0.3.x86_64.rpm)

# rpm -Uvh php-mbstring-5.4.16-23.el7_0.3.x86_64.rpm

(ftp://bo.mirror.garr.it/1/slc/centos/7.0.1406/updates/x86_64/Packages/php-bcmath-5.4.16-23.el7_0.3.x86_64.rpm)

# rpm -Uvh php-bcmath-5.4.16-23.el7_0.3.x86_64.rpm

OCI8扩展

为了安装OCI8,还得先安装下列包:

autoconf-2.69-11.el7.noarch.rpm

automake-1.13.4-3.el7.noarch.rpm

pcre-devel-8.32-14.el7.x86_64.rpm

php-devel-5.4.16-23.el7_0.3.x86_64.rpm (OS安装DVD中从来不,下载地址:

http://rpm.pbone.net/index.php3/stat/4/idpl/27829696/dir/centos_7/com/php-devel-5.4.16-23.el7_0.3.x86_64.rpm.html,这个包包含phpize)

OCI8 2.0 下充斥地址:

http://pecl.php.net/package/oci8

PHP 5.4 应该据此2.0.X本的oci8,更新版本是暨PHP 7 搭配使用的

# tar -xzf oci8-2.0.11.tgz

# cd oci8-2.0.11

# phpize

# ./configure –with-oci8=/u01/app/oracle/product/12.1.0/dbhome_1

# make install

修改/etc/php.ini

在文书最后加加一行:

extension=oci8.so

在/etc/ld.so.conf中上加oci8.so所在的路线,例如:

include ld.so.conf.d/*.conf

/root/oci8-2.0.11/modules

在/etc/sysconfig/httpd文件中上加必要的环境变量(不要加export):

ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

NLS_LANG=AMERICAN_AMERICA.AL32UTF8

测试

#service httpd start

将下列脚本存成ocitest.php,放在/var/www/html 目录下,保证可实行权:

<?php

error_reporting(E_ALL);

ini_set(‘display_errors’, ‘On’);

$conn = oci_connect(‘system’, ‘welcome’, ‘localhost/orcl’);

$stid = oci_parse($conn, ‘select table_name from user_tables’);

oci_execute($stid);

echo “<table>\n”;

while (($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS))
!= false) {

echo “<tr>\n”;

foreach ($row as $item) {

echo ” <td>”.($item !== null ? htmlspecialchars($item,
ENT_QUOTES) : ” “).”</td>\n”;

}

echo “</tr>\n”;

}

echo “</table>\n”;

?>

访问http://&lt;hostname&gt;:&lt;port&gt;/ocitest.php,正常应该在页面上返回system用户的所有表。

修改外PHP参数

改/etc/php.ini文件被的下列参数:

post_max_size = 16M

max_execution_time = 300

max_input_time = 300

date.timezone = Asia/Shanghai

开创数据库schema
建造数据库用户

SQL> create tablespace zabbix datafile
‘/u01/app/oracle/oradata/orcl/zabbix01.dbf’ size 500M;

Tablespace created.

SQL> create user zabbix identified by welcome1 default tablespace
zabbix;

User created.

SQL> grant connect,resource,unlimited tablespace to zabbix;

Grant succeeded.

SQL> grant create any directory to zabbix;

Grant succeeded.

SQL> grant drop any directory to zabbix;

Grant succeeded.

创建表结构

进去zabbix解压缩目录下之database/oracle目录,以zabbix用户身份登录数据库,运行3独sql脚本,创建表结构以及正数据:

[oracle@rhelvm1 oracle]$ id

uid=500(oracle) gid=501(dba) groups=501(dba)

[oracle@rhelvm1 oracle]$ pwd

/u01/stage/zabbix-3.2.1/database/oracle

[oracle@rhelvm1 oracle]$ sqlplus zabbix/welcome1

SQL*Plus: Release 12.1.0.2.0 Production on Thu Nov 10 11:20:43 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Last Successful login time: Thu Nov 10 2016 11:19:12 -08:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit
Production

With the Partitioning, OLAP, Advanced Analytics and Real Application
Testing options

SQL>

schema.sql需要改,将内nvarchar2(2048)都改成成为nvarchar2(2000),这是12c的限定,最可怜只能够2000了。

SQL>@schema.sql

images.sql需要修改,第一推行之目指向zabbix解压目录下的misc/images目录,我这边是/u01/stage/zabbix-3.2.1/misc/images

SQL>@images.sql

栽入正数据:

SQL>@data.sql

创建OS用户

groupadd zabbix

useradd -g zabbix zabbix

为了保运行zabbix程序时得正常引用Oracle库文件,需要安装ORACLE_HOME等环境变量,修改zabbix的.bash_profile设置,添加以下行:

ORACLE_BASE=/u01/app/oracle

export ORACLE_BASE

ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

export ORACLE_HOME

ORACLE_SID=orcl

export ORACLE_SID

PATH=$ORACLE_HOME/bin:$PATH

export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH

编译Zabbix

安装其他因包

起OL7的DVD中设置下列包,保证zabbix的编译能过够成功。

  • –with-net-snmp

#rpm -Uvh net-snmp-devel-5.7.2-20.el7.x86_64.rpm
elfutils-devel-0.160-1.el7.x86_64.rpm
elfutils-libelf-devel-0.160-1.el7.x86_64.rpm
lm_sensors-devel-3.3.4-11.el7.x86_64.rpm
net-snmp-agent-libs-5.7.2-20.el7.x86_64.rpm
openssl-devel-1.0.1e-42.el7.x86_64.rpm
perl-devel-5.16.3-285.el7.x86_64.rpm
rpm-devel-4.11.1-25.el7.x86_64.rpm
tcp_wrappers-devel-7.6-77.el7.x86_64.rpm
krb5-devel-1.12.2-14.el7.x86_64.rpm gdbm-devel-1.10-8.el7.x86_64.rpm
libdb-devel-5.3.21-17.el7_0.1.x86_64.rpm
systemtap-sdt-devel-2.6-8.0.1.el7.x86_64.rpm
popt-devel-1.13-16.el7.x86_64.rpm
libselinux-devel-2.2.2-6.el7.x86_64.rpm
libverto-devel-0.2.5-4.el7.x86_64.rpm pyparsing-1.5.6-9.el7.noarch.rpm
libcom_err-devel-1.42.9-7.el7.x86_64.rpm
keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm
libsepol-devel-2.1.9-3.el7.x86_64.rpm
perl-ExtUtils-Install-1.58-285.el7.noarch.rpm
perl-ExtUtils-MakeMaker-6.68-3.el7.noarch.rpm
perl-ExtUtils-ParseXS-3.18-2.el7.noarch.rpm
perl-ExtUtils-Manifest-1.61-244.el7.noarch.rpm

  • –with-libxml2

#rpm -Uvh libxml2-devel-2.9.1-5.0.1.el7_0.1.x86_64.rpm

  • –with-libcurl

#rpm -Uvh libcurl-devel-7.29.0-19.el7.x86_64.rpm

  • –with-libssh2

#rpm -Uvh libssh2-devel-1.4.3-8.el7.x86_64.rpm

(ftp://bo.mirror.garr.it/1/slc/centos/7.1.1503/os/x86_64/Packages/libssh2-devel-1.4.3-8.el7.x86_64.rpm)

编译安装

#su – zabbix

$cd /u01/stage/zabbix-

$./configure –prefix=/home/zabbix –enable-server –enable-agent
–with-oracle=/u01/app/oracle/product/12.1.0/dbhome_1 –with-net-snmp
–with-libcurl –with-libxml2 –with-ssh2

$make install

实施上述命令后,Zabbix会被设置于/home/zabbix目录下,运行命令启动server和本机agentd:

(在开行前如果修改etc/zabbix_server.conf文件,修改dbname,dbuser,dbpassword几个参数)

$cd

$sbin/zabbix_server

$sbin/zabbix_agentd

安装PHP应用

安装过程尽管是用PHP文件复制到apache http server对应的目录中:

#cd /var/www/html

#mkdir zabbix

# cd /u01/stage/zabbix-3.2.1/frontends/php

# cp -a . /var/www/html/zabbix

配置Zabbix

开辟浏览器,访问http://&lt;server\_ip\_or\_name&gt;/zabbix

图片 1

管教有pre-requisites都是OK的:

图片 2

图片 3

图片 4

末尾会唤醒闯将部署文件失败,我怀念是为咱们下OS自带的HTTPD的缘故,运行httpd的用户并未相应的目录访问权限,可以按照提示将部署文件另存,并手工复制到指定位置。

布局好后直转入登录页面。缺省用户以及口令是Admin/zabbix

图片 5

相关文章