拉斯维加斯(3499-官方认证)浏览器-Made in Las Vegas /index.php/interflow/technology/13219?utm_source=rss&utm_medium=rss&utm_campaign=zabbix-7-0%25e7%25bc%2596%25e8%25af%2591%25e9%2583%25a8%25e7%25bd%25b2%25e6%2595%2599%25e7%25a8%258b Tue, 12 Mar 2024 03:17:09 +0000 /?p=13219 zabbix7.0 alpha鐗堟湰銆乥eta鐗堟湰宸茬粡闄嗙画鍙戝竷锛寊abbix7.0 LTS鐗堟湰鍙戝竷鏃堕棿涔熻秺鏉ヨ秺杩戙€傛嵁浜嗚В锛屾柊鐨勭増鏈湪鎬ц兘鎻愬崌銆佹灦鏋勪紭鍖栫瓑鏂板姛鑳芥柟闈㈡湁闈炲父浜溂鐨勮〃鐜帮紝涓嶅皯灏忎紮浼村姝や篃宸茬粡璺冭穬娆茶瘯銆傚績鍔ㄤ笉濡傝鍔紝涓嶅Θ鍏堜綋楠屼簡涓€鎶奲eta鐗堟湰銆侟/p>

zabbix 7.0缂栬瘧閮ㄧ讲鏁欑▼鏈€鍏堝嚭鐜板湪涔愮淮瀹樼綉銆侟/p> ]]> zabbix7.0 alpha鐗堟湰銆乥eta鐗堟湰宸茬粡闄嗙画鍙戝竷锛寊abbix7.0 LTS鐗堟湰鍙戝竷鏃堕棿涔熻秺鏉ヨ秺杩戙€傛嵁浜嗚В锛屾柊鐨勭増鏈湪鎬ц兘鎻愬崌銆佹灦鏋勪紭鍖栫瓑鏂板姛鑳芥柟闈㈡湁闈炲父浜溂鐨勮〃鐜帮紝涓嶅皯灏忎紮浼村姝や篃宸茬粡璺冭穬娆茶瘯銆傚績鍔ㄤ笉濡傝鍔紝涓嶅Θ鍏堜綋楠屼簡涓€鎶奲eta鐗堟湰銆侟/h4>

鏈暀绋嬩粎閫傜敤浜庣紪璇戦儴缃瞶abbix7.0 beta1鐗堟湰锛岄儴缃茬幆澧冧负kylinV10銆侟/p>

浜嬪墠鍑嗗锛氳蒋浠跺寘涓嬭浇

kylinV10 sp2 x86_64: https://pan.baidu.com/s/1-pg76mcXLn8rWP22Adr1iA?pwd=lwjk 鎻愬彇鐮? lwjk

nginx: https://nginx.org/download/nginx-1.24.0.tar.gz

php: https://www.php.net/distributions/php-8.3.3.tar.gz

pg:https://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.gz

timescaledb:https://codeload.github.com/timescale/timescaledb/tar.gz/refs/tags/2.13.1

zabbix:https://cdn.zabbix.com/zabbix/sources/development/7.0/zabbix-7.0.0beta1.tar.gz

1. lnpp瀹夎

linux+nginx+postgresql+php

(1) 鏈搷浣滅ず渚嬩腑linux鐜浣跨敤kylinV10 SP2

(2) 鐜宸查厤缃叕缃憏um婧忺/p>

sDgb4P0265eac8d57770c.png

1.1. nginx瀹夎

閫夋嫨nginx鐗堟湰 1.24.0

(1)聽yum 瀹夎宸ュ叿鍙婄幆澧冧緷璧朁/p>

# 缂栬瘧宸ュ叿瀹夎
yum -y install gcc-c++
# nginx 渚濊禆瀹夎
yum -y install pcre-devel openssl-devel

(2) itops鐢ㄦ埛鍒涘缓# 绋嬪簭鐢ㄦ埛itops鍒涘缓
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鏈嶅姟鍚姩鍙婅嚜鍚痵ystemctl enable nginx –now

(7) 椤甸潰璁块棶娴嬭瘯

VuTZZQUV65eac8ecd4145.png

1.2. 鏁版嵁搴撳畨瑁匋/h3>

閫夋嫨postgresql 鐗堟湰16.2

閫夋嫨timescaledb 鐗堟湰2.13.1

(1) yum瀹夎宸ュ叿鍙婄幆澧冧緷璧杫um 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
# 鍒濆鍖朁br>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

# 鎵ц濡備笅鍛戒护浣垮彉閲忕敓鏁圏br>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浠ゆā鍧楃敓鏁圏br>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鏈嶅姟鍚姩鍙婅嚜鍚痵u – itops -c ‘pg_ctl stop’
systemctl enable postgresql –now

1.3. php瀹夎

閫夋嫨php鐗堟湰 8.3.3

(1) yum 瀹夎宸ュ叿鍙婄幆澧冧緷璧杘niguruma銆乷niguruma-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鐩稿叧鍙傛暟
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

2. zabbix瀹夎鍙婂惎鍔?/h2>

2.1. zabbix 缂栬瘧瀹夎

閫夋嫨zabbix鐗堟湰 7.0.0beta1

(1) yum 瀹夎缂栬瘧宸ュ叿鍙婁緷璧杫um -y install libssh2 libssh2-devel OpenIPMI-devel libevent-devel unixODBC unixODBC-devel java-1.8.0-openjdk-devel openssl-devel

(2) zabbix缂栬瘧鍙婇厤缃弬鏁板畾涔?nbsp;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搴撳垱寤? 鍒涘缓zabbix鐢ㄦ埛
su – itops -c ‘createuser –pwprompt zabbix’
# 杈撳叆鐢ㄦ埛瀵嗙爜

# 鍒涘缓zabbix搴掽br>su – itops -c ‘createdb -O zabbix -E Unicode -T template0 zabbix’

IcEI8eXo65eac8f3e7433.png

(4)聽鏁版嵁搴撹〃缁撴瀯瀵煎叆# 杩涘叆缂栬瘧鍖呮暟鎹簱璺緞涓婞br>cd zabbix-7.0.0beta1/database/postgresql/
# 瀵煎叆琛ㄧ粨鏋凕br>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’
# 鍏抽棴鍘嬬缉锛屽鏋滈渶瑕佹甯稿帇缂╋紝鍒欒烦杩囦笅鏂箂ed鍛戒护
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 鍗宠涓鸿秴琛ㄥ垱寤烘垚鍔燂紝鍏朵綑鎻愮ず淇℃伅鍙拷鐣?/p>

2.2. zabbix 鏈嶅姟鍙奱gent绋嬪簭鍚姩

(1) 鍚姩zabbix_server/opt/zabbix/sbin/zabbix_server
ss -lnt

phG8ctFv65eac900ae8a9.png

(2) zabbix agent鍚姩echo ‘User=itops’ >> /opt/zabbix/etc/zabbix_agentd.conf
/opt/zabbix/sbin/zabbix_agentd

2.3. zabbix_web 閰嶇疆鍙婂垵濮嬪寲

(1) web閮ㄧ讲# 杩涘叆缂栬瘧鍖呰矾寰勪笅
cd zabbix-7.0.0beta1/
# 鎷疯礉ui浠g爜鑷硁ginx
cp -r ui/ /opt/nginx/html/zabbix
chown itops: -R /opt/nginx/html/zabbix

(2) web椤甸潰鍒濆鍖栭厤缃?/p>

(3)聽閰嶇疆瀹屾垚鍗抽儴缃插畬鎴愩€傝烦杞櫥褰曢〉锛岄粯璁よ处鍙峰瘑鐮佷负Admin/zabbix銆侟/p>

涓婂氨鏄痾abbix7.0 beta1缂栬瘧閮ㄧ讲鐨勫叏閮ㄥ唴瀹癸紝鎰熷叴瓒g殑灏忎紮浼翠笉濡ㄦ姠鍏堜笂杞︿綋楠屻€侟/p>

姝ゅ锛屼箰缁寸洃鎺7.0鐗堟湰涔熷嵆灏嗕笌澶у瑙侀潰锛屾暚璇锋湡寰呫€侟/p>

澶у濂斤紝鎴戞槸涔愪箰锛屼笓娉ㄨ繍缁存妧鏈爺绌朵笌鍒嗕韩锛屾洿澶歾abbix绛夋妧鏈煡璇嗕笌闂锛屾杩庡埌涔愮淮绀惧尯浜ゆ祦~

zabbix 7.0缂栬瘧閮ㄧ讲鏁欑▼鏈€鍏堝嚭鐜板湪涔愮淮瀹樼綉銆侟/p> ]]>