zabbix3.4原始碼安裝步驟

聽雨軒主發表於2018-07-21

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 &
/app/weblogic/software/mysql5.6/mysql/bin/mysql -uroot -p –socket=/app/weblogic/software/mysql5.6/mysql.sock
3.安裝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
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
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]”

相關文章