centos上安装 zabbix+oracle

 centos上安装 zabbix+oracle 2013-06-13 15:19:11

分类: LINUX

 

centos上安装 zabbix+oracle


zabbix软件需求

Software Requirements

Zabbix is built around modern Apache WEB server, leading database engines, and the PHP scripting language.

The following software is required to run Zabbix:

Software 
Version 
Comments

Apache 
1.3.12 or later

PHP 
5.0 or later

PHP modules: 
php-gd
 
GD 2.0 or later 
PHP GD module must support PNG images.

PHP TrueType support 
--with-ttf

PHP bc support 
php-bcmath, --enable-bcmath

PHP XML support 
php-xml or php5-dom, if provided as a separate package by the distributor

PHP session support 
php-session, if provided as a separate package by the distributor

PHP socket support 
php-net-socket, --enable-sockets. Required for user script support.

PHP multibyte support 
php-mbstring, --enable-mbstring

IBM DB2 
ibm_db2
 
Required if IBM DB2 is used as Zabbix back end database.

MySQL 
php-mysql
 
3.22 or later 
Required if MySQL is used as Zabbix back end database.

Oracle 
oci8
 
Required if Oracle is used as Zabbix back-end database.

PostgreSQL 
php-pgsql
 
7.0.2 or later if Zabbix < 1.8.9 
7.4 or later if Zabbix >= 1.8.9 
Required if PostgreSQL is used as Zabbix back-end database. 
Consider using PostgreSQL 8.x or later for much better performance. 
It is suggested to use at least PostgreSQL 8.3, which introduced much better VACUUM performance.

SQLite 
php-sqlite3
 
3.3.5 or later 
Required if SQLite is used as Zabbix back-end database.

数据库端设置

create tablespace zabbix datafile '+ASM1/momorac/datafile/zabbix1.bdf' size 500M autoextend on next 50m maxsize 4096M; 
Alter Profile Default Limit Failed_Login_Attempts Unlimited; 
Alter Profile Default Limit Password_Life_Time Unlimited; 
Create User Zabbix Identified By 111111 Default Tablespace Zabbix; 
Grant Connect To Zabbix; 
Grant Resouse To Zabbix; 
Grant Unlimited Tablespace To Zabbix;

grant create any DIRECTORY to zabbix;

grant dba to zabbix; --临时授权

安装oracle即时客户端

数据库和zabbix没在同一台主机上,所以需要安装oracle即时客户端,也可以是oracle的客户端。只不过客户端比较庞大。

下载Oracle即时客户端程序包

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

数据库版本是11.2.0.3.0

Instant Client Package - Basic:

All files required to run OCI, OCCI, and JDBC-OCI applications

Image instantclient-basic-linux.x64-11.2.0.3.0.zip (60,331,694 bytes) (cksum - 3890813254)

oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm (59,492,344 bytes) (cksum - 3293107452) 
*Instant Client Package - SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client

instantclient-sqlplus-linux.x64-11.2.0.3.0.zip (837,574 bytes) (cksum - 3996754029)

oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm (831,586 bytes) (cksum - 2150224972)

*Instant Client Package - SDK:

Additional header files and an example makefile for developing Oracle applications with Instant Client

instantclient-sdk-linux.x64-11.2.0.3.0.zip (641,586 bytes) (cksum - 1205517808)

oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm (609,139 bytes) (cksum - 2701969031)

zip 或者 rpm 包选择一种,系统是centos,天生兼容RHEL,所以选择rpm格式的。

以64位为例,下载以下几个文件:

oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm

oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm

oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm

下载完以后装上。 rpm -Uhv

[root@my2950 zabbix]# rm -f oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm 
ll -h 
total 71M 
-rw-r--r--  1 root root  57M Jun  9 09:39 oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64(1).rpm 
-rw-r--r--  1 root root 595K Jun  8 18:01 oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm 
-rw-r--r--  1 root root 813K Jun  8 18:01 oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm 
drwxrwxr-x 13 1000 1000 4.0K Jun  8 17:11 zabbix-2.0.6 
-rw-r--r--  1 root root  13M Apr 22 20:34 zabbix-2.0.6.tar.gz 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -Uhv oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64\(1\).rpm 
99%)########################################### [100%] 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -Uhv oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm 
Preparing...                                                            (100%)#                                           (100%)##                                   99%)########################################### [100%] 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -Uhv oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm sqlplus-11.2.0.3.0-1.x86_64.rpm 
Preparing...                                                            (100%)#                                           (100%)##    

(100%)########################################### [100%] 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -qa|grep oracle 
oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64 
oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64 
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -ql oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64 
/usr/lib/oracle/11.2/client64/bin/adrci 
/usr/lib/oracle/11.2/client64/bin/genezi 
/usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 
/usr/lib/oracle/11.2/client64/lib/libnnz11.so 
/usr/lib/oracle/11.2/client64/lib/libocci.so.11.1 
/usr/lib/oracle/11.2/client64/lib/libociei.so 
/usr/lib/oracle/11.2/client64/lib/libocijdbc11.so 
/usr/lib/oracle/11.2/client64/lib/ojdbc5.jar 
/usr/lib/oracle/11.2/client64/lib/ojdbc6.jar 
/usr/lib/oracle/11.2/client64/lib/xstreams.jar 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm =-ql oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64 
/usr/include/oracle/11.2/client64/ldap.h 
/usr/include/oracle/11.2/client64/nzerror.h 
/usr/include/oracle/11.2/client64/nzt.h 
/usr/include/oracle/11.2/client64/occi.h 
/usr/include/oracle/11.2/client64/occiAQ.h 
/usr/include/oracle/11.2/client64/occiCommon.h 
/usr/include/oracle/11.2/client64/occiControl.h 
/usr/include/oracle/11.2/client64/occiData.h 
/usr/include/oracle/11.2/client64/occiObjects.h 
/usr/include/oracle/11.2/client64/oci.h 
/usr/include/oracle/11.2/client64/oci1.h 
/usr/include/oracle/11.2/client64/oci8dp.h 
/usr/include/oracle/11.2/client64/ociap.h 
/usr/include/oracle/11.2/client64/ociapr.h 
/usr/include/oracle/11.2/client64/ocidef.h 
/usr/include/oracle/11.2/client64/ocidem.h 
/usr/include/oracle/11.2/client64/ocidfn.h 
/usr/include/oracle/11.2/client64/ociextp.h 
/usr/include/oracle/11.2/client64/ocikpr.h 
/usr/include/oracle/11.2/client64/ocixmldb.h 
/usr/include/oracle/11.2/client64/ocixstream.h 
/usr/include/oracle/11.2/client64/odci.h 
/usr/include/oracle/11.2/client64/oratypes.h 
/usr/include/oracle/11.2/client64/ori.h 
/usr/include/oracle/11.2/client64/orid.h 
/usr/include/oracle/11.2/client64/orl.h 
/usr/include/oracle/11.2/client64/oro.h 
/usr/include/oracle/11.2/client64/ort.h 
/usr/include/oracle/11.2/client64/xa.h 
/usr/lib/oracle/11.2/client64/lib/libclntsh.so 
/usr/lib/oracle/11.2/client64/lib/libocci.so 
/usr/lib/oracle/11.2/client64/lib/ottclasses.zip 
/usr/share/oracle/11.2/client64/cdemo81.c 
/usr/share/oracle/11.2/client64/demo.mk 
/usr/share/oracle/11.2/client64/occidemo.sql 
/usr/share/oracle/11.2/client64/occidemod.sql 
/usr/share/oracle/11.2/client64/occidml.cpp 
/usr/share/oracle/11.2/client64/occiobj.cpp 
/usr/share/oracle/11.2/client64/occiobj.typ 
/usr/share/oracle/11.2/client64/ott 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -ql oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64basic-11.2.0.3.0-1.x86_64 
a|grep oracle 
oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64 
oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64 
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# 
[root@my2950 zabbix]# rpm -qa|grep oraclel oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64basic-11.2.0.3.0-1.x86_64oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64 
/usr/bin/sqlplus64 
/usr/lib/oracle/11.2/client64/bin/sqlplus 
/usr/lib/oracle/11.2/client64/lib/glogin.sql 
/usr/lib/oracle/11.2/client64/lib/libsqlplus.so 
/usr/lib/oracle/11.2/client64/lib/libsqlplusic.so 
[root@my2950 zabbix]# cd /usr/lib//oracle/11.2/client64/ 
bin/ lib/ 
[root@my2950 zabbix]# cd /usr/lib/oracle/11.2/client64/ 
[root@my2950 client64]# ls 
bin  lib 
[root@my2950 client64]# 
[root@my2950 client64]# 
[root@my2950 client64]# 
[root@my2950 client64]# tree 

bin 
   adrci 
   genezi 
   sqlplus 
lib 
     glogin.sql 
     libclntsh.so -> libclntsh.so.11.1 
     libclntsh.so.11.1 
     libnnz11.so 
     libocci.so -> libocci.so.11.1 
     libocci.so.11.1 
     libociei.so 
     libocijdbc11.so 
     libsqlplusic.so 
     libsqlplus.so 
     ojdbc5.jar 
     ojdbc6.jar 
     ottclasses.zip 
     xstreams.jar 
2 directories, 17 files 
[root@my2950 client64]# ls 
bin  lib 
[root@my2950 client64]# 
[root@my2950 client64]# 
[root@my2950 client64]# ls lib/ 
glogin.sql    libclntsh.so.11.1  libocci.so       libociei.so      libsqlplusic.so  ojdbc5.jar  ottclasses.zip 
libclntsh.so  libnnz11.so        libocci.so.11.1  libocijdbc11.so  libsqlplus.so    ojdbc6.jar  xstreams.jar 
[root@my2950 client64]#

[root@my2950 client64]# pwd 
/usr/lib/oracle/11.2/client64 
[root@my2950 client64]# cd bin/ 
[root@my2950 bin]# 
[root@my2950 bin]# ./sqlplus 
./sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory 
[root@my2950 bin]#

添加 Oracle libraries



[root@my2950 zabbix-2.0.6]# more /etc/ld.so.conf.d/oracle.conf 
/usr/lib/oracle/11.2/client64/lib 
[root@my2950 zabbix-2.0.6]#

[root@my2950 bin]# ldconfig 
[root@my2950 bin]# ./sqlplus 
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 9 10:24:26 2013 
Copyright (c) 1982, 2011, Oracle.  All rights reserved. 
Enter user-name: 
ERROR: 
ORA-12162: TNS:net service name is incorrectly specified 
Enter user-name: ^C 
[root@my2950 bin]#

测试一下:

[root@my2950 oracle]# sqlplus zabbix/111111@10.101.5.77/MOMORAC.momo.org 
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 9 12:21:29 2013 
Copyright (c) 1982, 2011, Oracle.  All rights reserved. 
Connected to: 
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production 
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security, 
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options 
SQL>

初始化 oracle 数据库

建用户


[root@my2950 oracle]# groupadd -g 2000 zabbix 
[root@my2950 oracle]# useradd -g zabbix -u 2000 zabbix 
[root@my2950 oracle]# id zabbix 
uid=2000(zabbix) gid=2000(zabbix) groups=2000(zabbix) 
[root@my2950 oracle]#

[root@my2950 oracle]# groupadd -g 2000 zabbix 
[root@my2950 oracle]# useradd -g zabbix -u 2000 zabbix 
[root@my2950 oracle]# id zabbix 
uid=2000(zabbix) gid=2000(zabbix) groups=2000(zabbix) 
[root@my2950 oracle]#

[root@my2950 oracle]# pwd 
/root/zabbix/zabbix-2.0.6/database/oracle 
[root@my2950 oracle]# ll 
total 820 
-rw-rw-r-- 1 1000 1000 728094 Apr 22 20:32 data.sql 
-rw-rw-r-- 1 1000 1000  14861 Apr 22 20:31 images.sql 
-rw-rw-r-- 1 1000 1000  92598 Apr 22 20:32 schema.sql

运行顺序 schema.sql -->  images.sql --> data.sql

前两个需要sql需要处理一下 schema.sql 需要把2048替换成2000

下 vi 打开 :%s/2048/2000/g 或者 sed -i 's/2048/2000/g' schema.sql

images.sql  需要把/home/zabbix/zabbix/create/output_png 换成自己的目录,当然也可以创建这个目录然后把图片什么的拷贝进去

处理一下 images.sql 
sed -i 's%/home/zabbix/zabbix/create/output_png%/home/zabbix/%g' images.sql

[root@my2950 oracle]#

[root@my2950 oracle]# sqlplus zabbix/111111@10.101.5.77/MOMORAC.momo.org 
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 9 12:21:29 2013 
Copyright (c) 1982, 2011, Oracle.  All rights reserved. 
Connected to: 
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production 
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security, 
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options 
SQL> 

SQL> @image.sql 
SP2-0310: unable to open file "image.sql" 
SQL> host pwd 
/root/zabbix/zabbix-2.0.6/database/oracle 
SQL> host ls 
data.sql  images.sql  schema.sql 
SQL> @images.sql 
CREATE OR REPLACE DIRECTORY image_dir AS '/home/zabbix/zabbix/create/output_png' 

ERROR at line 1: 
ORA-01031: insufficient privileges 
Procedure created. 
BEGIN 

ERROR at line 1: 
ORA-22285: non-existent directory or file for FILEOPEN operation 
ORA-06512: at "SYS.DBMS_LOB", line 805 
ORA-06512: at "ZABBIX.LOAD_IMAGE", line 8 
ORA-06512: at line 2 
Procedure dropped. 
DROP DIRECTORY image_dir 

ERROR at line 1: 
ORA-01031: insufficient privileges 
SQL>

17上创建个逻辑卷通过nfs共享出去,供zabbix使用

[root@my2950 oracle]# lvcreate -L 5G -n zabbix_share datavg 
  Logical volume "zabbix_share" created 
[root@my2950 oracle]# mkfs 
mkfs          mkfs.cramfs   mkfs.ext3     mkfs.ext4dev  mkfs.vfat     
mkfs.btrfs    mkfs.ext2     mkfs.ext4     mkfs.msdos    mkfs.xfs      
[root@my2950 oracle]# mkfs.xfs /dev/datavg/zabbix_share 
meta-data=/dev/datavg/zabbix_share isize=256    agcount=4, agsize=327680 blks 
         =                       sectsz=512   attr=2 
data     =                       bsize=4096   blocks=1310720, imaxpct=25 
         =                       sunit=0      swidth=0 blks 
naming   =version 2              bsize=4096   ascii-ci=0 
log      =internal log           bsize=4096   blocks=2560, version=2 
         =                       sectsz=512   sunit=0 blks, lazy-count=1 
realtime =none                   extsz=4096   blocks=0, rtextents=0 
[root@my2950 oracle]#
[root@my2950 oracle]# vi /etc/fstab  
/dev/datavg/zabbix_share              /home/zabbix               xfs    defaults        1 2 
[root@my2950 oracle]# mount /home/zabbix 
[root@my2950 oracle]# 
[root@my2950 oracle]# chown -R 2000:2000 /home/zabbix 
[root@my2950 oracle]# chmod -R 777 /home/zabbix 
[root@my2950 oracle]#
rac  三个节点分别mount nfs,然后分别创建 zabbix 用户.(通过SCAN ip 访问后端RAC,不知道会落在那个节点上,所以三个节点都需要同样的访问权限。)
mkdir -p /home/zabbix; chmod -R 777 /home/zabbix;
/etc/fstab 添加:
my2950.momo.org:/home/zabbix /home/zabbix         nfs     rw,bg,hard,nointr,tcp,vers=3,timeo=300,rsize=32768,wsize=32768,actimeo=0  0 0
groupadd -g 2000 zabbix;useradd -g 2000 -u 2000 zabbix;
grant create any DIRECTORY to zabbix; 再试
drop user zabbix cascade;


Grant Connect To Zabbix; 
Grant Resource To Zabbix; 
Grant Unlimited Tablespace To Zabbix; 
Grant Create any Directory To Zabbix; 
grant dba to zabbix; 


schema.sql 
SQL>  @sehema.sql 
Directory created. 
Procedure created. 
BEGIN 

ERROR at line 1: 
ORA-22288: file or LOB operation FILEOPEN failed 
No such file or directory 
ORA-06512: at "SYS.DBMS_LOB", line 805 
ORA-06512: at "ZABBIX.LOAD_IMAGE", line 8 
ORA-06512: at line 2 
Procedure dropped. 
Directory dropped. 
SQL>
[zabbix@node2 ~]$ mkdir -p /home/zabbix/zabbix/create/output_png 
[zabbix@node2 ~]$ ls -l /home/zabbix/zabbix/create/output_png 
total 0 
[zabbix@node2 ~]$ ls -l /home/zabbix/zabbix/create/ 
total 0 
drwxr-xr-x 2 zabbix zabbix 6 Jun  9 14:27 output_png 
[zabbix@node2 ~]$
然后把 源码目录下的 ./misc/images/png_modern 拷贝到 /home/zabbix 下
[root@my2950 zabbix-2.0.6]# pwd 
/root/zabbix/zabbix-2.0.6 
[root@my2950 zabbix-2.0.6]# 
[root@my2950 zabbix-2.0.6]# 
[root@my2950 zabbix-2.0.6]# find ./ -name Workstation_(128).png -print 
-bash: syntax error near unexpected token `(' 
[root@my2950 zabbix-2.0.6]# 
[root@my2950 zabbix-2.0.6]# 
[root@my2950 zabbix-2.0.6]# find ./ -name Workstation_*png -print      
./frontends/php/images/sysmaps/Workstation_small.png 
./misc/images/png_modern/Workstation_(48).png 
./misc/images/png_modern/Workstation_(128).png 
./misc/images/png_modern/Workstation_(24).png 
./misc/images/png_modern/Workstation_(64).png 
./misc/images/png_modern/Workstation_(96).png 
./misc/images/png_classic/Workstation_small.png 
[root@my2950 zabbix-2.0.6]# 
[root@my2950 zabbix-2.0.6]# cd misc/images/ 
[root@my2950 images]# ls 
png_classic  png_modern  png_to_xml.sh  README 
[root@my2950 images]# cd png_modern/ 
[root@my2950 png_modern]# pwd 
/root/zabbix/zabbix-2.0.6/misc/images/png_modern
[root@my2950 png_modern]# pwd 
/root/zabbix/zabbix-2.0.6/misc/images/png_modern 
[root@my2950 png_modern]# cd ../ 
[root@my2950 images]# cp -r png_modern /home/zabbix/ 
.bash_history  .bash_logout   .bash_profile  .bashrc        .kshrc         .viminfo       .vimrc         zabbix/ 
[root@my2950 images]# cp -r png_modern /home/zabbix/ 
[root@my2950 images]# ls -l /home/zabbix/ 
total 12 
drwxr-xr-x 2 root   root   8192 Jun  9 14:41  png_modern 
drwxr-xr-x 3 zabbix zabbix   19 Jun  9 14:27 zabbix 
[root@my2950 images]# chown -R zabbix:zabbix /home/zabbix 
zabbix/      zabbix.orig/ 
[root@my2950 images]# chown -R zabbix:zabbix /home/zabbix/png_modern 
[root@my2950 images]# 
[root@my2950 images]#
再执行
SQL>  @images.sql 
Directory created. 
Procedure created. 
PL/SQL procedure successfully completed. 
Procedure dropped. 
Directory dropped. 
SQL>

Change table “items” column “description” from nclob to nvarchar(2000) due to zabbixbug  https://support.zabbix.com/browse/ZBX-4239
SQL> alter table items add(new_description nvarchar2(2000)); 
Table altered. 
SQL> update items set new_description = DESCRIPTION; 
0 rows updated. 
SQL> alter table items drop column DESCRIPTION; 
Table altered. 
SQL> alter table items rename column new_description to DESCRIPTION; 
Table altered. 
SQL>


        SQL>@data.sql


编译安装 zabbix

[root@my2950 ~]# mkdir zabbix

[root@my2950 ~]#

[root@my2950 ~]#

[root@my2950 ~]#

[root@my2950 ~]# cd zabbix/

[root@my2950 zabbix]# ls

[root@my2950 zabbix]#

[root@my2950 zabbix]#

[root@my2950 zabbix]#

[root@my2950 zabbix]# wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX

--2013-06-08 17:02:34--  http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%2

Resolving jaist.dl.sourceforge.net... 150.65.7.130, 2001:200:141:feed::feed

Connecting to jaist.dl.sourceforge.net|150.65.7.130|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 13402400 (13M) [application/x-gzip]

Saving to: “zabbix-2.0.6.tar.gz”

97% [===========================================================================                                                                                                 ========================================================>    ] 13,052,328   168K                                                                                                 100%[======================================>] 13,402,400   143K/s   in 59s

2013-06-08 17:03:33 (223 KB/s) - “zabbix-2.0.6.tar.gz” saved [13402400/13402400]

[root@my2950 zabbix]#

编译 zabbix :

./configure --prefix/usr/local/zabbix --enable-server --with-oracle=/usr/lib/oracle/11.2/client64 --with-net-snmp --with-jabber --with-libcurl

config.status: creating include/config.h 
config.status: executing depfiles commands 
类似下边的结果意味着编译成功通过

config.status: executing depfiles commands 
Configuration: 
  Detected OS:           linux-gnu 
  Install path:          /usr/local 
  Compilation arch:      linux 
  Compiler:              gcc 
  Compiler flags:        -g -O2   -I/usr/lib/oracle/11.2/client64/rdbms/public -I/usr/lib/oracle/11.2/client64/rdbms/demo      -I/usr/include/rpm -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include  -I/usr/include 
  Enable server:         yes 
  Server details: 
    With database:         Oracle 
    WEB Monitoring via:    cURL 
    Native Jabber:         yes 
    SNMP:                  net-snmp 
    IPMI:                  no 
    SSH:                   yes 
    ODBC:                  no 
    Linker flags:          -rdynamic      -L/usr/lib/oracle/11.2/client64/lib      -L/usr/lib64  -L/usr/lib64 -L/usr/lib 
    Libraries:             -lm -lrt  -lresolv     -lclntsh -lnnz11   -liksemel  -lcurl  -lnetsnmp -lcrypto  -lnetsnmp -lcrypto -lssh2 
  Enable proxy:          no 
  Enable agent:          no 
  Enable Java gateway:   no 
  LDAP support:          no 
  IPv6 support:          no 
*********************************************************** 
*            Now run 'make install'                       * 
*                                                         * 
*            Thank you for using Zabbix!                  * 
*              <http://www.zabbix.com>                    * 
***********************************************************

[root@my2950 zabbix-2.0.6]#

可能会遇到的错误:

错误: 

checking for net-snmp-config... no 
configure: error: Invalid NET-SNMP directory - unable to find net-snmp-config 
[root@my2950 zabbix-2.0.6]#

解决: yum install net-snmp-devel
错误:
checking for localname in struct snmp_session... yes 
checking for SSH2 support... no 
configure: error: SSH2 library not found 
[root@my2950 zabbix-2.0.6]#
解决:[root@my2950 zabbix-2.0.6]# yum install php-pecl-ssh2.x86_64 libssh2-devel.x86_64

制作rpm包

安装 checkinstall
wget  ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/andnagy/RedHat_RHEL-6/x86_64/checkinstall-1.6.2-20.2.x86_64.rpm
[root@my2950 zabbix-2.0.6]# rpm -Uhv checkinstall-1.6.2-20.2.x86_64.rpm 
warning: checkinstall-1.6.2-20.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 73a77345: NOKEY 
Preparing...                ########################################### [100%] 
   1:checkinstall           ########################################### [100%] 
[root@my2950 zabbix-2.0.6]#
configure && make 之后使用 checkinstall
Image
继续
Image(1)
name 修改成 zabbix-server-oracle
有个错误
/bin/mkdir: cannot create directory `/usr/local/share/zabbix': No such file or directory 
make[5]: *** [install-data-hook] Error 1 
make[5]: Leaving directory `/root/zabbix/zabbix-2.0.6/src/zabbix_server' 
make[4]: *** [install-data-am] Error 2 
make[4]: Leaving directory `/root/zabbix/zabbix-2.0.6/src/zabbix_server' 
make[3]: *** [install-am] Error 2 
make[3]: Leaving directory `/root/zabbix/zabbix-2.0.6/src/zabbix_server' 
make[2]: *** [install-recursive] Error 1 
make[2]: Leaving directory `/root/zabbix/zabbix-2.0.6/src/zabbix_server' 
make[1]: *** [install-recursive] Error 1 
make[1]: Leaving directory `/root/zabbix/zabbix-2.0.6/src' 
make: *** [install-recursive] Error 1 
****  Installation failed. Aborting package creation. 
Cleaning up...OK 
Bye. 
[root@my2950 zabbix-2.0.6]#
[root@my2950 zabbix-2.0.6]# ll /usr/local/share/zabbix 
ls: cannot access /usr/local/share/zabbix: No such file or directory 
[root@my2950 zabbix-2.0.6]# mkdir -p /usr/local/share/zabbix 
[root@my2950 zabbix-2.0.6]#
继续
又有错误:
Building file list...OK 
/root/rpmbuild has no SOURCES directory. Please write the path to 
the RPM source directory tree:
[root@my2950 zabbix-2.0.6]# yum install rpmdevtools
然后运行  rpmdev-setuptree
[root@my2950 zabbix-2.0.6]# rpmdev-setuptree 
[root@my2950 zabbix-2.0.6]#
继续

Copying files to the temporary directory...OK 
Stripping ELF binaries and libraries...OK 
Compressing man pages...OK 
Building file list...OK 
Building RPM package...OK 
NOTE: The package will not be installed 
Erasing temporary files...OK 
Deleting temp dir...OK 
********************************************************************** 
Done. The new package has been saved to 
/root/rpmbuild/RPMS/x86_64/zabbix-server-oracle-2.0.6-1.x86_64.rpm 
You can install it in your system anytime using: 
      rpm -i zabbix-server-oracle-2.0.6-1.x86_64.rpm 
********************************************************************** 
[root@my2950 zabbix-2.0.6]#

[root@my2950 zabbix-2.0.6]# cp /root/rpmbuild/RPMS/x86_64/zabbix-server-oracle-2.0.6-1.x86_64.rpm /root/zabbix/ 
[root@my2950 zabbix-2.0.6]# cd /root/zabbix/ 
[root@my2950 zabbix]# ll 
total 73052 
-rw-r--r--  1 root root 59492344 Jun  9 09:39 oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64(1).rpm 
-rw-r--r--  1 root root   609139 Jun  8 18:01 oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm 
-rw-r--r--  1 root root   831586 Jun  8 18:01 oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm 
drwxrwxr-x 14 1000 1000     4096 Jun  9 16:41 zabbix-2.0.6 
-rw-r--r--  1 root root 13402400 Apr 22 20:34 zabbix-2.0.6.tar.gz 
-rw-r--r--  1 root root   450757 Jun  9 16:42 zabbix-server-oracle-2.0.6-1.x86_64.rpm 
[root@my2950 zabbix]# rpm -Uhv zabbix-server-oracle-2.0.6-1.x86_64.rpm 
error: Failed dependencies: 
        libclntsh.so.11.1()(64bit) is needed by zabbix-server-oracle-2.0.6-1.x86_64 
        libnnz11.so()(64bit) is needed by zabbix-server-oracle-2.0.6-1.x86_64 
[root@my2950 zabbix]# rpm -Uhv zabbix-server-oracle-2.0.6-1.x86_64.rpm --nodeps 
Preparing...                ########################################### [100%] 
   1:zabbix-server-oracle   ########################################### [100%] 
[root@my2950 zabbix]#

======================== Installation successful ========================== 
Copying documentation directory... 
./ 
./README 
./INSTALL 
./AUTHORS 
./NEWS 
./ChangeLog 
./COPYING 
Copying files to the temporary directory...OK 
Stripping ELF binaries and libraries...OK 
Compressing man pages...OK 
Building file list...OK 
Building RPM package...OK 
NOTE: The package will not be installed 
Erasing temporary files...OK 
Deleting temp dir...OK 
********************************************************************** 
Done. The new package has been saved to 
/root/rpmbuild/RPMS/x86_64/zabbix-2.0.6-1.x86_64.rpm 
You can install it in your system anytime using: 
      rpm -i zabbix-2.0.6-1.x86_64.rpm 
********************************************************************** 
[root@my2950 zabbix-2.0.6]# 


[root@my2950 zabbix-2.0.6]# cp /root/rpmbuild/RPMS/x86_64/zabbix-2.0.6-1.x86_64.rpm ./ 



安装 zabbix

[root@my2950 zabbix-2.0.6]# rpm -Uhv zabbix-2.0.6-1.x86_64.rpm 
error: Failed dependencies: 
        libclntsh.so.11.1()(64bit) is needed by zabbix-2.0.6-1.x86_64 
        libnnz11.so()(64bit) is needed by zabbix-2.0.6-1.x86_64 
[root@my2950 zabbix-2.0.6]#
修改 /etc/profile
export ORACLE_HOME=/usr/lib/oracle/11.2/client64 
export ORACLE_BASE=/usr/lib/oracle 
export PATH=$PATH:$ORACLE_HOME/bin 
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
[root@my2950 zabbix-2.0.6]# rpm -Uhv zabbix-2.0.6-1.x86_64.rpm 
error: Failed dependencies: 
        libclntsh.so.11.1()(64bit) is needed by zabbix-2.0.6-1.x86_64 
        libnnz11.so()(64bit) is needed by zabbix-2.0.6-1.x86_64 
[root@my2950 zabbix-2.0.6]# rpm -Uhv zabbix-2.0.6-1.x86_64.rpm --nodeps 
Preparing...                ########################################### [100%] 
   1:zabbix                 ########################################### [100%] 
[root@my2950 zabbix-2.0.6]# 
[root@my2950 zabbix-2.0.6]# rpm -ql zabbix 
/usr 
/usr/doc 
/usr/doc/zabbix 
/usr/doc/zabbix/AUTHORS 
/usr/doc/zabbix/COPYING 
/usr/doc/zabbix/ChangeLog 
/usr/doc/zabbix/INSTALL 
/usr/doc/zabbix/NEWS 
/usr/doc/zabbix/README 
/usr/local 
/usr/local/etc 
/usr/local/etc/zabbix_server.conf 
/usr/local/sbin 
/usr/local/sbin/zabbix_server 
/usr/local/share 
/usr/local/share/man 
/usr/local/share/man/man8 
/usr/local/share/man/man8/zabbix_server.8.gz 
[root@my2950 zabbix-2.0.6]#

安装oci8,php访问oracle需要用到

wget ftp://ftp.pbone.net/mirror/rpms.famillecollet.com/enterprise/6/olds/x86_64/php-oci8-5.3.19-1.el6.remi.x86_64.rpm

[root@my2950 conf.d]#
[root@my2950 conf.d]#
[root@my2950 conf.d]# rpm -Uhv php-oci8-5.3.19-1.el6.remi.x86_64.rpm
warning: php-oci8-5.3.19-1.el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
error: Failed dependencies:
         php-pdo(x86-64) = 5.3.19-1.el6.remi is needed by php-oci8-5.3.19-1.el6.remi.x86_64
[root@my2950 conf.d]# rpm -qa|grep php-pdo
php-pdo-5.3.3-22.el6.x86_64
[root@my2950 conf.d]# rpm -Uhv php-oci8-5.3.19-1.el6.remi.x86_64.rpm  --nodeps
warning: php-oci8-5.3.19-1.el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing...                ########################################### [100%]
    1:php-oci8               ########################################### [100%] 
[root@my2950 conf.d]#





Installing zabbix repository configuration package

rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm
[root@my2950 oracle]#  yum --enablerepo=zabbix search zabbix

zabbix.x86_64 : zabbix with oracle 
zabbix-agent.x86_64 : Zabbix Agent 
zabbix-get.x86_64 : Zabbix Get 
zabbix-java-gateway.x86_64 : Zabbix java gateway 
zabbix-proxy.x86_64 : Zabbix Proxy 
zabbix-proxy-mysql.x86_64 : Zabbix proxy compiled to use MySQL 
zabbix-proxy-pgsql.x86_64 : Zabbix proxy compiled to use PostgreSQL 
zabbix-proxy-sqlite3.x86_64 : Zabbix proxy compiled to use SQLite 
zabbix-release.noarch : Zabbix repository configuration 
zabbix-sender.x86_64 : Zabbix Sender 
zabbix-server.x86_64 : Zabbix server common files 
zabbix-server-mysql.x86_64 : Zabbix server compiled to use MySQL 
zabbix-server-pgsql.x86_64 : Zabbix server compiled to use PostgresSQL 
zabbix-server-sqlite3.x86_64 : Zabbix server compiled to use SQLite 
zabbix-web.noarch : Zabbix Web Frontend 
zabbix-web-japanese.noarch : Japanese font for Zabbix web frontend 
zabbix-web-mysql.noarch : Zabbix web frontend for MySQL 
zabbix-web-pgsql.noarch : Zabbix web frontend for PostgreSQL 
zabbix-web-sqlite3.noarch : Zabbix web frontend for SQLite 
zabbix20-agent.x86_64 : Zabbix Agent 
zabbix20-proxy.x86_64 : Zabbix Proxy 
zabbix20-proxy-mysql.x86_64 : Zabbix proxy compiled to use MySQL 
zabbix20-proxy-pgsql.x86_64 : Zabbix proxy compiled to use PostgreSQL 
zabbix20-proxy-sqlite3.x86_64 : Zabbix proxy compiled to use SQLite 
zabbix20-server.x86_64 : Zabbix server common files 
zabbix20-server-mysql.x86_64 : Zabbix server compiled to use MySQL 
zabbix20-server-pgsql.x86_64 : Zabbix server compiled to use PostgresSQL 
zabbix20-web.noarch : Zabbix Web Frontend 
zabbix20-web-mysql.noarch : Zabbix web frontend for MySQL 
zabbix20-web-pgsql.noarch : Zabbix web frontend for PostgreSQL 
zabbix20.x86_64 : Open-source monitoring solution for your IT infrastructure 
  Name and summary matches only, use "search all" for everything. 
[root@my2950 oracle]#

[root@my2950 oracle]#  yum --enablerepo=zabbix install zabbix-get.x86_64 zabbix-sender.x86_64 zabbix-server.x86_64 zabbix20-web.noarch

修改zabbix配置文件:
[root@my2950 zabbix]# more zabbix_server.conf|grep ^[^#$] 
ListenPort=10051 
LogFile=/var/log/zabbix/zabbix_server.log 
LogFileSize=10 
DebugLevel=2 
PidFile=/var/run/zabbix/zabbix_server.pid 
DBHost=10.101.5.77 
DBName=MOMORAC.MOMO.ORG 
DBUser=zabbix 
DBPassword=111111 
DBSocket=/var/lib/mysql/mysql.sock 
DBPort=1521 
SNMPTrapperFile=/var/log/snmptt/snmptt.log 
AlertScriptsPath=/usr/lib/zabbix/alertscripts 
ExternalScripts=/usr/lib/zabbix/externalscripts 
[root@my2950 zabbix]#
http://10.101.0.17/zabbix/
image
编辑  /etc/php.ini
[Date]

date.timezone = Asia/Shanghai

重启apache,继续

数据库选oracle 点击测试的时候直接白屏

后台:

[Sun Jun 09 16:09:26 2013] [error] [client 10.101.5.66] PHP Fatal error:  Call to undefined function zbx_dbstr() in /usr/share/zabbix/include/db.inc.php on line 126, referer:http://10.101.0.17/zabbix/

查看提到的文件 db.inc.php

                        case ZBX_DB_ORACLE: 
112                                 $connect = ''; 
113                                 if (!empty($DB['SERVER'])) { 
114                                         $connect = '//'.$DB['SERVER']; 
115 
116                                         if ($DB['PORT'] != '0') { 
117                                                 $connect .= ':'.$DB['PORT']; 
118                                         } 
119                                         if ($DB['DATABASE']) { 
120                                                 $connect .= '/'.$DB['DATABASE']; 
121                                         } 
122                                 } 
123 
124                                 $DB['DB'] = ociplogon($DB['USER'], $DB['PASSWORD'], $connect); 
125                                 if ($DB['DB']) { 
126                                        DBexecute('ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.zbx_dbstr('. ')); 
127                                 } 
128                                 else { 
129                                         $error = 'Error connecting to database'; 
130                                         $result = false; 
131                                 } 
132                                 break;

替换一下:

DBexecute('ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.zbx_dbstr('. ')); 
DBexecute('ALTER SESSION SET NLS_NUMERIC_CHARACTERS=",."');

继续。

Image(2)

The default user name is Admin, password zabbix.

日志发现

21235:20130609:163157.798 [Z3001] connection to database 'MOMORAC.MOMO.ORG' failed: [2013] Lost connection to MySQL server at 'reading initial com 
munication packet', system error: 0

[root@my2950 zabbix]# which zabbix_server 
/usr/sbin/zabbix_server 
[root@my2950 zabbix]# ll /usr/sbin/zabbix_server 
lrwxrwxrwx 1 root root 31 Jun  9 15:16 /usr/sbin/zabbix_server -> /etc/alternatives/zabbix-server 
[root@my2950 zabbix]# ll /etc/alternatives/zabbix-server 
lrwxrwxrwx 1 root root 29 Jun  9 15:16 /etc/alternatives/zabbix-server -> /usr/sbin/zabbix_server_mysql 
[root@my2950 zabbix]#

[root@my2950 zabbix]# cd /etc/alternatives/zabbix-server 
-bash: cd: /etc/alternatives/zabbix-server: Not a directory 
[root@my2950 zabbix]# cd /etc/alternatives/ 
[root@my2950 alternatives]# rpm -ql zabbix-server-oracle-2.0.6-1.x86_64 
/usr 
/usr/doc 
/usr/doc/zabbix-server-oracle 
/usr/doc/zabbix-server-oracle/AUTHORS 
/usr/doc/zabbix-server-oracle/COPYING 
/usr/doc/zabbix-server-oracle/ChangeLog 
/usr/doc/zabbix-server-oracle/INSTALL 
/usr/doc/zabbix-server-oracle/NEWS 
/usr/doc/zabbix-server-oracle/README 
/usr/local 
/usr/local/sbin 
/usr/local/sbin/zabbix_server 
/usr/local/share 
/usr/local/share/man 
/usr/local/share/man/man8 
/usr/local/share/man/man8/zabbix_server.8.gz 
[root@my2950 alternatives]# ll 
total 0 
lrwxrwxrwx. 1 root root 10 Aug 28  2012 ksh -> /bin/ksh93 
lrwxrwxrwx. 1 root root 30 Aug 28  2012 ksh-man -> /usr/share/man/man1/ksh93.1.gz 
lrwxrwxrwx  1 root root 20 Aug 30  2012 mkisofs -> /usr/bin/genisoimage 
lrwxrwxrwx  1 root root 20 Aug 30  2012 mkisofs-mkhybrid -> /usr/bin/genisoimage 
lrwxrwxrwx  1 root root 36 Aug 30  2012 mkisofs-mkisofsman -> /usr/share/man/man1/genisoimage.1.gz 
lrwxrwxrwx. 1 root root 26 Aug 28  2012 mta -> /usr/sbin/sendmail.postfix 
lrwxrwxrwx. 1 root root 40 Aug 28  2012 mta-aliasesman -> /usr/share/man/man5/aliases.postfix.5.gz 
lrwxrwxrwx. 1 root root 22 Aug 28  2012 mta-mailq -> /usr/bin/mailq.postfix 
lrwxrwxrwx. 1 root root 38 Aug 28  2012 mta-mailqman -> /usr/share/man/man1/mailq.postfix.1.gz 
lrwxrwxrwx. 1 root root 27 Aug 28  2012 mta-newaliases -> /usr/bin/newaliases.postfix 
lrwxrwxrwx. 1 root root 43 Aug 28  2012 mta-newaliasesman -> /usr/share/man/man1/newaliases.postfix.1.gz 
lrwxrwxrwx. 1 root root 23 Aug 28  2012 mta-pam -> /etc/pam.d/smtp.postfix 
lrwxrwxrwx. 1 root root 22 Aug 28  2012 mta-rmail -> /usr/bin/rmail.postfix 
lrwxrwxrwx. 1 root root 25 Aug 28  2012 mta-sendmail -> /usr/lib/sendmail.postfix 
lrwxrwxrwx. 1 root root 41 Aug 28  2012 mta-sendmailman -> /usr/share/man/man1/sendmail.postfix.1.gz 
lrwxrwxrwx  1 root root 43 Aug 30  2012 spice-xpi-client -> /usr/libexec/spice-xpi-client-remote-viewer 
lrwxrwxrwx. 1 root root 33 Aug 28  2012 xinputrc -> /etc/X11/xinit/xinput.d/ibus.conf 
lrwxrwxrwx  1 root root 29 Jun  9 15:16 zabbix-server -> /usr/sbin/zabbix_server_mysql 
lrwxrwxrwx  1 root root 38 Jun  9 15:30 zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf 
[root@my2950 alternatives]# rm -f zabbix-server 
[root@my2950 alternatives]# ln -s /usr/local/sbin/zabbix_server zabbix-server 
[root@my2950 alternatives]#

重启zabbix-server 再次查看日志:

[root@my2950 alternatives]# tail -f /var/log/zabbix/zabbix_server.log 
22011:20130609:164424.512 ****** Enabled features ****** 
22011:20130609:164424.512 SNMP monitoring:           YES 
22011:20130609:164424.512 IPMI monitoring:            NO 
22011:20130609:164424.512 WEB monitoring:            YES 
22011:20130609:164424.512 Jabber notifications:      YES 
22011:20130609:164424.512 Ez Texting notifications:  YES 
22011:20130609:164424.512 ODBC:                       NO 
22011:20130609:164424.512 SSH2 support:               NO 
22011:20130609:164424.512 IPv6 support:               NO 
22011:20130609:164424.512 ****************************** 
22014:20130609:164433.736 server #1 started [configuration syncer #1] 
22015:20130609:164433.743 server #2 started [db watchdog #1] 
22022:20130609:164433.744 server #9 started [trapper #1] 
22023:20130609:164433.747 server #10 started [trapper #2] 
22024:20130609:164433.747 server #11 started [trapper #3] 
22025:20130609:164433.748 server #12 started [trapper #4] 
22026:20130609:164433.752 server #13 started [trapper #5] 
22028:20130609:164433.762 server #15 started [alerter #1] 
22030:20130609:164433.763 server #17 started [timer #1] 
22027:20130609:164433.769 server #14 started [icmp pinger #1] 
22029:20130609:164433.771 server #16 started [housekeeper #1] 
22033:20130609:164433.776 server #20 started [history syncer #1] 
22031:20130609:164433.777 server #18 started [http poller #1] 
22034:20130609:164433.782 server #21 started [history syncer #2] 
22011:20130609:164433.783 server #0 started [main process] 
22037:20130609:164433.784 server #24 started [escalator #1] 
22035:20130609:164433.787 server #22 started [history syncer #3] 
22036:20130609:164433.788 server #23 started [history syncer #4] 
22038:20130609:164433.791 server #25 started [proxy poller #1] 
22039:20130609:164433.794 server #26 started [self-monitoring #1] 
22032:20130609:164434.149 server #19 started [discoverer #1] 
22019:20130609:164434.242 server #6 started [poller #4] 
22017:20130609:164434.246 server #4 started [poller #2] 
22020:20130609:164434.248 server #7 started [poller #5] 
22016:20130609:164434.273 server #3 started [poller #1] 
22021:20130609:164434.276 server #8 started [unreachable poller #1] 
22018:20130609:164434.280 server #5 started [poller #3]

OK

#END


转载于:https://my.oschina.net/houranlee/blog/336284

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在 CentOS 7 上安装 Zabbix 6.0、Nginx、MySQL 8、PHP 7.4 的步骤: 1. 安装 EPEL 和 Remi 源: ``` yum install -y epel-release rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm ``` 2. 安装 Nginx: ``` yum install -y nginx systemctl start nginx systemctl enable nginx ``` 3. 安装 PHP 7.4: ``` yum install -y php74-php-fpm php74-php-mysqlnd php74-php-xmlrpc php74-php-gd php74-php-intl php74-php-mbstring php74-php-soap php74-php-xml php74-php-json php74-php-zip systemctl start php74-php-fpm systemctl enable php74-php-fpm ``` 4. 安装 MySQL 8: ``` rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm yum install -y mysql-community-server systemctl start mysqld systemctl enable mysqld ``` 5. 配置 MySQL: ``` mysql_secure_installation ``` 6. 创建 Zabbix 数据库: ``` mysql -u root -p CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost'; FLUSH PRIVILEGES; EXIT; ``` 7. 导入 Zabbix 数据库: ``` cd /usr/share/doc/zabbix-server-mysql-6.0.0/ zcat create.sql.gz | mysql -u zabbix -p zabbix ``` 8. 安装 Zabbix Server 和 Agent: ``` yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent ``` 9. 配置 Zabbix: ``` vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=password ``` 10. 启动 Zabbix Server 和 Agent: ``` systemctl start zabbix-server zabbix-agent systemctl enable zabbix-server zabbix-agent ``` 11. 配置 Nginx: ``` vi /etc/nginx/conf.d/zabbix.conf server { listen 80; server_name localhost; root /usr/share/zabbix; location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/run/php74-php-fpm/zabbix.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` 12. 重启 Nginx: ``` systemctl restart nginx ``` 13. 打开浏览器,输入服务器 IP 地址,进入 Zabbix Web 界面,按照提示进行 Zabbix 配置即可。 注意:以上步骤仅供参考,具体操作根据实际情况进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值