关于如何搭建DM7的zabbix环境
环境简介:虚拟机版本:CentOS Linux release 7.4.1708 httpd版本:httpd-2.2.34PHP版本:php-5.5.38zabbix版本:zabbix-3.0.3 目录说明:httpd、php、zabbix均安装在了/test下了,所有和目录相关的配置项可根据自己的目录进行更改。 一、首先安装zabbix可能依赖的包 yum install -y libxml2 libxml2-devel curlcurl-devel libjpeg libpng freetype libjpeg-devel libpng-devel freetype-develyum install -y libssh2-develnet-snmp-devel OpenIPMI-develyum install -y apr apr-devel apr-utiapr-util-devel二、安装httpd
1.编译: ./configure --prefix=/test/httpd--enable-module=so2.安装:make install3.将zabbix下的PHP文件拷贝到httpd目录下:cp zabbix-3.0.3/frontends/php/*httpd/htdocs/ -r4.将httpd/htdocs/include/下的db.inc.php替换为dm的。5.修改httpd.conf配置文件,修改详情见附件httpd.conf。 三、安装php
1.编译:./configure --prefix=/test/php--with-config-file-path=/test/php/etc --enable-fpm --with-fpm-user=php-fpm--with-fpm-group=php-fpm--with-oci8=/install_pkg/oracle_tmp--with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir--with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf--enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear--with-curl --enable-bcmath --enable-sockets --with-gettext --with-apxs2=/test/httpd/bin/apxs
2.安装:make install
3.配置dm php(详情可参考DM7_Program.pdf手册):a.将ext目录拷贝到php目录下:cp ext/ /test/php/ -rb.在httpd.conf文件中添加 DirectoryIndex default.php default.phtmldefault.php3 default.html default.htmAddType application/x-httpd-php .php.phtml .php3 .incAddType application/x-httpd-php-source.phpsc.修改php.ini配置文件定位php.ini文件:# locate php.ini/install_pkg/other/php.ini/install_pkg/php-5.5.38/php.ini-development/install_pkg/php-5.5.38/php.ini-production# cp/install_pkg/php-5.5.38/php.ini-development /test/php/etc/php.ini修改/test/php/etc/php.ini文件: Directory in which the loadable extensions(modules) reside.extension-dirextension_dir = "./"On windows:extension_dir=/test/php/ext //注意路径为绝对路径extension=libphp55_dm.so 注:这部分添加到最后,以免被开启的默认值覆盖掉post_max_size = 16Mmax_execution_time = 300max_input_time = 300date.timezone = Asia/Shanghaialways_populate_raw_post_data = -1 添加dm模块:dm.allow_persistent = 1dm.max_persistent = -1dm.max_links = -1dm.default_host = localhostdm.default_user = SYSDBAdm.default_pw = SYSDBAdm.connect_timeout = 10dm.defaultlrl = 4096dm.defaultbinmode = 1dm.check_persistent = ON
四、安装zabbix
1.修改源码vim zabbix-3.0.3/src/libs/zbxdb/db.c ,共两处:
2.修改dm_svc.conf内容(屏蔽关键字):KEYWORDS=(function,object,value)
3.修改SQL脚本:zabbix-3.0.3/database/oracle/images.sql中的目录路径为/install_pkg/zabbix-3.0.3/misc/images
4.导入zabbix数据:sp_set_para_value(1,'PWD_POLICY',0);create user ZABBIX identified by"ZABBIX";grant resource to zabbix;利用disql(zabbix用户)依次执行zabbix-3.0.3/database/oracle/下三个脚本:schema.sqlimages.sqldata.sql
创建两个视图:create or replace view col as selecttable_name tname,column_name cname from USER_TAB_COLUMNS;create or replace view tab as selecttable_name tname,'TABLE' tabtype from USER_TABLES;
5.编译zabbix:编译之前需先配置环境变量,oracle_tmp文件夹下是编译zabbix所需的oracle库文件:exportLD_LIBRARY_PATH=/install_pkg/oracle_tmp:$LD_LIBRARY_PATH./configure --prefix=/test/zabbix--with-oracle=/install_pkg/oracle_tmp --with-net-snmp --with-libcurl--with-libxml2 --enable-server --enable-agent --enable-proxy --with-ssh2--with-openipmi --enable-java
6.安装:make install
7.配置zabbix服务端,修改 /test/zabbix/etc/zabbix_server.conf文件这几项: SourceIP=127.0.0.1DBHost=127.0.0.1DBName=zabbixDBUser=zabbixDBPassword=ZABBIXDBPort=5236AllowRoot=1
8.安装时依赖的是oracle的客户端库文件libclntsh.so.11.1,启动时需替换成达梦的,方式是:将附件中的 libclntsh.so.11.1.dm_debug (记得改为和oracle同名)拷进dm的bin文件夹下,然后设置环境变量:exportLD_LIBRARY_PATH=/opt/dmdbms/bin:$LD_LIBRARY_PATH并通过 ldd /test/zabbix/sbin/zabbix_server查看是否已指向dm的库。
9.确认环境无误后,可启动服务端:/test/zabbix/sbin/zabbix_server
10.在浏览器中输入地址 http://你的IP/setup.php,进入以下页面:
按照提示填写相关信息,最后跳转到以下页面,即说明配置完成:
注:编译zabbix时提示缺什么包就安装什么包即可,我的系统在配置时最小化安装,所以把开头那些安装了以后,应该就不会缺什么了。 注:通过以下方式可确认php.ini文件路径是否正确在/test/httpd/htdocs目录下,新建文件vim phpinfo.php,内容为:<?php phpinfo();?>,在http://localhost/phpinfo.php页面中可查看php相关信息注:测试PHP是否连上dm,在httpd/htdocs下创建dmtest.php,内容如下:<?php$link = dm_connect("localhost","SYSDBA", "SYSDBA")or die("Could not connect : " .dm_error());print "Connected successfully";dm_close($link);
原创:达梦
页:
[1]