美文网首页
zabbix3.4源码编译安装

zabbix3.4源码编译安装

作者: Q_JacK_Q | 来源:发表于2018-07-21 22:16 被阅读0次

    zabbix3.4源码安装步骤

    1.安装环境:

    安装机器:22.224.9.227 以下简称监控机;

    操作系统信息:内核版本:

    Linux version 2.6.18-194.1.AXS3 (packager@asianux.com) (gcc version 4.1.2 20080704 (Asianux 3.0 4.1.2-48)) #1 SMP Fri May 7 10:03:53 CST 2010

    发行版本:Red Flag Asianux Server 3 for x86_64 (Quartet SP3)

    由于考虑到mysql存的数据量比较大,所以安装的目录要比较大,故考虑安装在weblogic/weblogic家目录下面

    由于官方推荐服务端和客户端必须在不同的用户下面运行,故考虑将server端安装在monitor/monitor下面,所有的agent运行在应用用户下面


    2.mysql5.6安装:weblogic/weblogic用户下面,安装目录:/app/weblogic/software/mysql5.6

    直接使用原有mysql,拷贝修改相应的配置文件即可

    启动命令:

    nohup /app/weblogic/software/mysql5.6/mysql/bin/mysqld --defaults-file=/app/weblogic/software/mysql5.6/mysql/conf/my.cnf --basedir=/app/weblogic/software/mysql5.6/mysql --datadir=/app/weblogic/software/mysql5.6/data --plugin-dir=/app/weblogic/software/mysql5.6/mysql/lib/plugin --log-error=/app/weblogic/software/mysql5.6/data/monap4.err --pid-file=/app/weblogic/software/mysql5.6/monap4.pid --socket=/app/weblogic/software/mysql5.6/mysql.sock --port=3306 --explicit_defaults_for_timestamp &

    使用socket方式登录

    /app/weblogic/software/mysql5.6/mysql/bin/mysql -uroot -p --socket=/app/weblogic/software/mysql5.6/mysql.sock


    3.安裝http:注意apr和apr-util 使用HTTP自带

    mkdir -p /app/weblogic/software/httpd-2.2.23

    mkdir -p /app/weblogic/software/httpd-2.2.23/apr

    mkdir -p /app/weblogic/software/httpd-2.2.23/apr-util

    cd /app/weblogic/software/zabbix_setup

    tar -xvf httpd-2.2.23.tar.gz

    cd /app/weblogic/software/zabbix_setup/httpd-2.2.23/srclib/apr

    ./configure --prefix=/app/weblogic/software/httpd-2.2.23/apr

    make

    make install

    cd /app/weblogic/software/zabbix_setup/httpd-2.2.23/srclib/apr-util

    ./configure --prefix=/app/weblogic/software/httpd-2.2.23/apr-util --with-apr=/app/weblogic/software/httpd-2.2.23/apr

    make

    make install 

    cd /app/weblogic/software/zabbix_setup/httpd-2.2.23

    ./configure --prefix=/app/weblogic/software/httpd-2.2.23 --with-apr=/app/weblogic/software/httpd-2.2.23/apr --with-apr-util=/app/weblogic/software/httpd-2.2.23/apr-util --enable-module=shared

    make

    make install

    vim httpd.conf 修改配置http支持:

        AddType application/x-httpd-php .php

        AddType application/x-httpd-php-source .php5

        DirectoryIndex index.html index.php


    4.PHP安裝:

    1.安装libiconv-1.14 php依赖:

         cd /app/weblogic/software/zabbix_setup/libiconv-1.14

         ./configure --prefix=/app/weblogic/software/php-5.6.33/libiconv

         make 

         make install

    cd /app/weblogic/software/zabbix_setup/mhash-0.9.9.9        #没有安装

    ./configure --prefix=/app/weblogic/software/php-5.6.33/mhash

    make

    make install

    cd /app/weblogic/software/zabbix_setup/libmcrypt-2.5.7

    ./configure --prefix=/app/weblogic/software/php-5.6.33/libmcrypt    #没有安装

    make

    make install

    cd /app/weblogic/software/zabbix_setup/mcrypt-2.6.8

    export LD_LIBRARY_PATH=/app/weblogic/software/php-5.6.33/libmcrypt/lib:/app/weblogic/software/php-5.6.33/mhash/lib:/app/weblogic/software/php-5.6.33/libiconv/lib:/usr/local/lib                                      #没有使用            

    export LDFLAGS="-L/app/weblogic/software/php-5.6.33/mhash/lib/ -I/app/weblogic/software/php-5.6.33/mhash/include/"                                                   #没有使用

    export CFLAGS="-I/app/weblogic/software/php-5.6.33/mhash/include/"

    ./configure --prefix=/app/weblogic/software/php-5.6.33/mcrypt --with-libiconv-prefix=/app/weblogic/software/php-5.6.33/libiconv --with-libmcrypt-prefix=/app/weblogic/software/php-5.6.33/libmcrypt

    cd /app/weblogic/software/zabbix_setup/php-5.6.33

    ./configure \

    --prefix=/app/weblogic/software/php-5.6.33 \

    --with-mysql \

    --with-mysqli=mysqlnd \

    --with-pdo-mysql=mysqlnd \

    --with-iconv-dir=/app/weblogic/software/php-5.6.33/libiconv \

    --with-freetype-dir \

    --with-jpeg-dir \

    --with-png-dir \

    --with-zlib \

    --with-libxml-dir=/usr \

    --with-gettext \

    --enable-xml \

    --disable-rpath \

    --enable-bcmath \

    --enable-shmop \

    --enable-sysvsem \

    --enable-inline-optimization \

    --with-curl \

    --enable-mbregex \

    --enable-fpm \

    --enable-mbstring \

    --with-gd \

    --enable-gd-native-ttf \

    --with-openssl \

    --enable-pcntl \

    --enable-sockets \

    --with-xmlrpc \

    --enable-soap \

    --enable-short-tags \

    --enable-static \

    --with-xsl \

    --with-apxs2=/app/weblogic/software/httpd-2.2.23/bin/apxs \

    --enable-ftp \

    --enable-opcache=no

    make 

    make install

    cd /app/weblogic/software/httpd-2.2.23/bin

    vim ../htdocs/index.php

    <?php

    phpinfo();

    ?>

    ./apachectl start

    http://192.168.99.12:8080/index.php


    5.zabbix server端安装:我自己本机安装需要安装MySQL-dev

    cd /app/weblogic/software/zabbix_setup/zabbix-3.4.10

    ./configure --prefix=/app/weblogic/software/zabbix3.4 --enable-server --enable-java --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

    make

    make isntall

    6.配置server端,主要配置日志路径和数据库相关

    建立相关的目录:

    mkdir /app/weblogic/software/zabbix3.4/log/

    mkdir /app/weblogic/software/zabbix3.4/SocketDir

    mkdir /app/weblogic/software/zabbix3.4/SNMPTrapperFile/

    mkdir /app/weblogic/software/zabbix3.4/alertscripts

    mkdir /app/weblogic/software/zabbix3.4/externalscripts

    配置文件:

    LogFile=/app/weblogic/software/zabbix3.4/log/zabbix_server.log

    LogFileSize=0

    PidFile=/app/weblogic/software/zabbix3.4/zabbix_server.pid

    SocketDir=/app/weblogic/software/zabbix3.4/SocketDir

    DBHost=192.168.99.2

    DBPort=3306

    DBName=zabbix

    DBUser=root

    DBPassword=jack

    SNMPTrapperFile=/app/weblogic/software/zabbix3.4/SNMPTrapperFile/zabbix_traps.tmp

    Timeout=4

    AlertScriptsPath=/app/weblogic/software/zabbix3.4/alertscripts

    ExternalScripts=/app/weblogic/software/zabbix3.4/externalscripts

    LogSlowQueries=3000

    7.配置php:

    cd /app/weblogic/software/httpd-2.2.23/htdocs

    mkdir zabbix

    cd /app/weblogic/software/zabbix_setup/zabbix-3.4.10/frontends/php

    cp -r * /app/weblogic/software/httpd-2.2.23/htdocs/zabbix/

    cd /app/weblogic/software/php-5.6.33/lib

    vim php.ini

    max_execution_time = 300

    max_input_time = 300

    session.auto_start = 0

    mbstring.func_overload = 0

    always_populate_raw_post_data = -1

    date.timezone =Asia/Shanghai

    8.界面配置:

    Admin/zabbix

    语言选择支持中文

    9.agent安装:

    cd /app/weblogic/zabbix-3.4.10

    ./configure --prefix=/home/monitor/zabbix_agent --enable-agent 

    make

    make install

    /home/monitor/software/httpd-2.2.23/bin/zabbix_agent/sbin

    ./zabbix_agentd -c ../etc/zabbix_agentd.conf

    配置:

    /home/monitor/zabbix_agent/log

    PidFile=/home/monitor/zabbix_agent/zabbix_agentd.pid

    LogFile=/home/monitor/zabbix_agent/log/zabbix_agentd.log

    PidFile=/home/monitor/zabbix-agent/zabbix_agentd.pid

    LogFile= /home/monitor/zabbix-agent/logs/zabbix_agentd.log

    Hostname=JacK2

    Include=/home/monitor/zabbix-agent/etc/zabbix_agentd.conf.d/

    Include=/home/monitor/zabbix-agent/etc/zabbix_agentd.conf.d/*.conf

    http://192.168.99.12:8080/zabbix/zabbix.php?action=dashboard.view&ddreset=1

    测试命令 zabbix_get -s 22.224.9.228 10050 -k "system.cpu.load[all,avg1]"

    相关文章

      网友评论

          本文标题:zabbix3.4源码编译安装

          本文链接:https://www.haomeiwen.com/subject/zzoeuftx.html