熱門搜索 Zabbix技術資料 Zabbix常見問、答討論 成功案例 Zabbix交流區(qū) Prometheus交流區(qū)
本教程僅適用于編譯部署zabbix7.0 beta1版本,部署環(huán)境為kylinV10。
kylinV10 sp2 x86_64:?http://pan.baidu.com/s/1-pg76mcXLn8rWP22Adr1iA?pwd=lwjk?提取碼: lwjk
nginx:?http://nginx.org/download/nginx-1.24.0.tar.gz
php:?http://www.php.net/distributions/php-8.3.3.tar.gz
pg:http://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.gz
timescaledb:http://codeload.github.com/timescale/timescaledb/tar.gz/refs/tags/2.13.1
zabbix:http://cdn.zabbix.com/zabbix/sources/development/7.0/zabbix-7.0.0beta1.tar.gz
linux+nginx+postgresql+php
(1) 本操作示例中l(wèi)inux環(huán)境使用kylinV10 SP2
(2) 環(huán)境已配置公網(wǎng)yum源
選擇nginx版本 1.24.0
(1)?yum 安裝工具及環(huán)境依賴
# 編譯工具安裝
yum -y install gcc-c++
# nginx 依賴安裝
yum -y install pcre-devel openssl-devel
(2)?itops用戶創(chuàng)建# 程序用戶itops創(chuàng)建
groupadd itops
useradd -g itops itops
echo Kylin_p@ssw0rd | passwd –stdin itops
(3) nginx編譯操作tar xf nginx-1.24.0.tar.gz
cd nginx-1.24.0/
./configure –user=itops –group=itops –prefix=/opt/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module –with-pcre
make -j8 && make install
(4) nginx配置文件編寫?mv /opt/nginx/conf/nginx.conf /opt/nginx/conf/nginx.bak
vi /opt/nginx/conf/nginx.conf
#i#輸入
user ?itops itops;
worker_processes ?1;
error_log ?logs/error.log ?crit;
error_log ?logs/error.log ?notice;
error_log ?logs/error.log ?info;
pid ???????logs/nginx.pid;
events {
????worker_connections ?1024;
}
http {
????include ??????mime.types;
????default_type ?application/octet-stream;
????#access_log ?logs/access.log ?main;
????sendfile ???????on;
????#tcp_nopush ????on;
????#keepalive_timeout ?0;
????keepalive_timeout ?65;
????#gzip ?on;
????server {
????????listen ??????80;
????????server_name ?localhost;
????????#charset koi8-r;
????????#access_log ?logs/host.access.log ?main;
????????location / {
????????????root ??html;
????????????index ?index.html index.htm index.php;
????????}
????????error_page ??500 502 503 504 ?/50x.html;
????????location = /50x.html {
????????????root ??html;
????????}
????????location ~ \.php$ {
????????????fastcgi_pass ??127.0.0.1:9000;
????????????fastcgi_index ?index.php;
????????????fastcgi_param ?SCRIPT_FILENAME ?$document_root$fastcgi_script_name;
????????????include ???????fastcgi_params;
????????}
????}
}
?# 測試nginx配置格式
chown itops: -R /opt/zabbix
/opt/nginx/sbin/nginx -t
(5) nginx服務文件編寫vi /usr/lib/systemd/system/nginx.service
#i# 輸入
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
ExecReload=/opt/nginx/sbin/nginx -s reload
ExecStop=/opt/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
(6) nginx服務啟動及自啟systemctl enable nginx –now
(7)?頁面訪問測試
選擇postgresql 版本16.2
選擇timescaledb 版本2.13.1
(1) yum安裝工具及環(huán)境依賴yum install -y unzip gcc gcc-c++ perl readline readline-devel openssl openssl-devel zlib zlib-devel ncurses-devel perl-ExtUtils-Embed python python-devel libxslt* python3-devel
(2) cmake 工具安裝yum install cmake -y
# cmake版本需大于3.4版本,如yum方式安裝cmake版本低,則需要用手動編譯方式進行替換
cmake –version
(3)?PG編譯安裝# 編譯PG
tar xf postgresql-16.2.tar.gz
cd postgresql-16.2/
./configure –prefix=/opt/postgresql –with-pgport=5432 –with-segsize=16 –with-blocksize=32 –with-wal-blocksize=64 –with-libedit-preferred –with-perl –with-openssl –with-libxml –with-python –with-libxslt –enable-thread-safety –enable-nls=en_US.UTF-8 –without-icu
make -j8 && make install
# 初始化
mkdir /data
chown itops: /data
su – itops
/opt/postgresql/bin/initdb -D /data/postgresql -E utf8
# 啟動
/opt/postgresql/bin/pg_ctl -D /data/postgresql/ start
# 設定全局變量
vim /etc/profile
#i # 尾行追加如下部分
PATH=/opt/postgresql/bin:/usr/bin:/usr/sbin:/bin:/sbin/bin
export PATH
PG_CONFIG=/opt/postgresql/bin/pg_config
export PG_CONFIG
PGDATA=/data/postgresql
export PGDATA
LD_LIBRARY_PATH=/opt/postgresql/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# 執(zhí)行如下命令使變量生效
source /etc/profile
(4)?TS時序庫編譯(可選)tar xf timescaledb-2.13.1.tar.gz
cd timescaledb-2.13.1/
echo y | ./bootstrap -DREGRESS_CHECKS=OFF
cd ./build && make
make install
# PG配置載入ts模塊
echo “shared_preload_libraries = ‘timescaledb'” >> /data/postgresql/postgresql.conf
# 重啟pg令模塊生效
su – itops -c ‘pg_ctl restart’
(5) pg服務文件編寫vi /usr/lib/systemd/system/postgresql.service
#i# 輸入
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
User=itops
Group=itops
Environment=PGPORT=5432
Environment=PGDATA=/data/postgresql
OOMScoreAdjust=-1000
ExecStart=/opt/postgresql/bin/pg_ctl start -D ${PGDATA} -s -o “-p ${PGPORT}” -w -t 300
ExecStop=/opt/postgresql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/opt/postgresql/bin/pg_ctl reload -D ${PGDATA} -s
TimeoutSec=300
[Install]
WantedBy=multi-user.target
(6) pg服務啟動及自啟su – itops -c ‘pg_ctl stop’
systemctl enable postgresql –now
選擇php版本 8.3.3
(1) yum 安裝工具及環(huán)境依賴oniguruma、oniguruma-devel包(kylinV10)?yum -y install libxml2-devel bzip2-devel libcurl-devel libpng-devel libjpeg-devel freetype-devel gmp-devel openldap-devel readline-devel libxslt-devel net-snmp-devel
cp -frp /usr/lib64/libldap* /usr/lib/
yum install oniguruma-*
?# 編譯安裝php
tar xf php-8.3.3.tar.gz
cd php-8.3.3/
./configure –prefix=/opt/php –with-config-file-path=/opt/php/etc –with-pgsql=/opt/postgresql –with-pdo-pgsql=/opt/postgresql –enable-gd –enable-bcmath –with-jpeg –with-freetype –enable-ctype –enable-xml ?–enable-session –enable-sockets –enable-mbstring –with-gettext –with-ldap –with-openssl –without-pdo-sqlite –without-sqlite3 –enable-fpm
sed -i “s@-lcrypto@-lcrypto -llber@g” Makefile
make -j8 && make install
# 配置php相關參數(shù)
cp php.ini-production /opt/php/etc/php.ini
ln -s /opt/php/etc/php.ini /etc/php.ini
cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf
cp /opt/php/etc/php-fpm.d/www.conf.default /opt/php/etc/php-fpm.d/www.conf
sed -i “s@user = nobody@user = itops@g” /opt/php/etc/php-fpm.d/www.conf
sed -i “s@group = nobody@group = itops@g” /opt/php/etc/php-fpm.d/www.conf
sed -i “s@pm.max_children = 5@pm.max_children = ?30@g” /opt/php/etc/php-fpm.d/www.conf
sed -i “s@;pid = run/php-fpm.pid@pid = run/php-fpm.pid@g” /opt/php/etc/php-fpm.d/www.conf
sed -i “s@post_max_size = 8M@post_max_size = 16M@g” /opt/php/etc/php.ini
sed -i “s@max_execution_time = 30@max_execution_time = 300@g” /opt/php/etc/php.ini
sed -i “s@max_input_time = 60@max_input_time = 300@g” /opt/php/etc/php.ini
# 生成php-fpm啟動文件
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chown -R itops: /opt/php
systemctl enable php-fpm –now
選擇zabbix版本 7.0.0beta1
(1) yum 安裝編譯工具及依賴yum -y install libssh2 libssh2-devel OpenIPMI-devel libevent-devel unixODBC unixODBC-devel java-1.8.0-openjdk-devel openssl-devel
(2)?zabbix編譯及配置參數(shù)定義?tar xf zabbix-7.0.0beta1.tar.gz
cd zabbix-7.0.0beta1
./configure –prefix=/opt/zabbix –enable-server –enable-agent –with-postgresql=/opt/postgresql/bin/pg_config –with-net-snmp –with-libcurl –with-libxml2 –with-unixodbc –with-openipmi –enable-ipv6 –enable-java –with-openssl –with-ssh2 –with-iconv –with-iconv-include –with-iconv-lib –with-libpcre –with-libevent –with-zlib –with-zlib-include –with-zlib-lib –with-libpthread –with-ldap
make -j8 && make installchown itops: -R /opt/zabbix
vi /opt/zabbix/etc/zabbix_server.conf
# 文件最后追加如下行
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=ZABBIX
DBPort=5432
Timeout=4
LogSlowQueries=3000
User=itops
StatsAllowedIP=127.0.0.1
(3) zabbix庫創(chuàng)建# 創(chuàng)建zabbix用戶
su – itops -c ‘createuser –pwprompt zabbix’
# 輸入用戶密碼
# 創(chuàng)建zabbix庫
su – itops -c ‘createdb -O zabbix -E Unicode -T template0 zabbix’
(4)?數(shù)據(jù)庫表結構導入# 進入編譯包數(shù)據(jù)庫路徑下
cd zabbix-7.0.0beta1/database/postgresql/
# 導入表結構
cat schema.sql | /opt/postgresql/bin/psql -Uzabbix zabbix
cat images.sql | /opt/postgresql/bin/psql -Uzabbix zabbix
cat data.sql | /opt/postgresql/bin/psql -Uzabbix zabbix
/opt/postgresql/bin/psql -Uzabbix zabbix -c ‘CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE’
# 關閉壓縮,如果需要正常壓縮,則跳過下方sed命令
sed -i ‘s#compression_status=1#compression_status=0#g’ timescaledb/schema.sql
cat timescaledb/schema.sql | /opt/postgresql/bin/psql -Uzabbix zabbix
# 拋出 TimescaleDB is configured successfully 即視為超表創(chuàng)建成功,其余提示信息可忽略
(1) 啟動zabbix_server/opt/zabbix/sbin/zabbix_server
ss -lnt
(2)?zabbix agent啟動echo ‘User=itops’ >> /opt/zabbix/etc/zabbix_agentd.conf
/opt/zabbix/sbin/zabbix_agentd
(1) web部署# 進入編譯包路徑下
cd zabbix-7.0.0beta1/
# 拷貝ui代碼至nginx
cp -r ui/ /opt/nginx/html/zabbix
chown itops: -R /opt/nginx/html/zabbix
(2) web頁面初始化配置
(3)?配置完成即部署完成。跳轉登錄頁,默認賬號密碼為Admin/zabbix。
上就是zabbix7.0 beta1編譯部署的全部內容,感興趣的小伙伴不妨搶先上車體驗。
此外,尊龍時凱監(jiān)控V7.0版本也即將與大家見面,敬請期待。
大家好,我是樂樂,專注運維技術研究與分享,更多zabbix等技術知識與問題,歡迎到尊龍時凱社區(qū)交流~
尊龍時凱參加了本次zabbix大會,詳細介紹了尊龍時凱產品如何結合zabbix進行二次開發(fā),實現(xiàn)企業(yè)運維監(jiān)控的需求
View detailsZabbix官方未發(fā)布針對以上兩項漏洞的補丁,但可以通過版本升級的方式修復漏洞。以下將介紹詳細修復方案,包括編譯升級與免編譯替換升級方式。
View detailsZabbix在觀看次數(shù)和與其他產品對比上都獲得了最多的關注被IT Central Station評為最佳網(wǎng)絡監(jiān)控軟件
View details? 精彩內容 zabbix5.0版本上新可謂萬眾期待,根據(jù)官方發(fā)布的最新功能列表,我們看到了其中有許多亮點,比如本地或云端部署、單點登錄、豎版菜單欄、界面可視化升級等,給廣大ZBX迷們帶來了操作的便利...
View details尊龍時凱采用分布式實施,分別對主機、網(wǎng)絡、存儲、數(shù)據(jù)庫、中間件、應用、硬件和虛擬化等實施一站式監(jiān)控。
View details尊龍時凱一站式的監(jiān)控了IT基礎架構和業(yè)務系統(tǒng),同時還為重要業(yè)務系統(tǒng)設計業(yè)務地圖,針對核心業(yè)務多維度重點保障。
View details采用分布式實施,分別集中監(jiān)控線上(阿里云) IT基礎架構和線下IT基礎架構,將不同類別的基礎架構統(tǒng)一在一個平臺上實現(xiàn)監(jiān)控功能。分別對主機、網(wǎng)絡、存儲、數(shù)據(jù)...
View details