{"id":13219,"date":"2024-03-12T11:17:09","date_gmt":"2024-03-12T03:17:09","guid":{"rendered":"https:\/\/www.lwops.cn\/?p=13219"},"modified":"2024-03-12T11:17:10","modified_gmt":"2024-03-12T03:17:10","slug":"zabbix-7-0%e7%bc%96%e8%af%91%e9%83%a8%e7%bd%b2%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.lwops.cn\/index.php\/interflow\/technology\/13219","title":{"rendered":"zabbix 7.0\u7f16\u8bd1\u90e8\u7f72\u6559\u7a0b"},"content":{"rendered":"\n
\u672c\u6559\u7a0b\u4ec5\u9002\u7528\u4e8e\u7f16\u8bd1\u90e8\u7f72zabbix7.0 beta1\u7248\u672c\uff0c\u90e8\u7f72\u73af\u5883\u4e3akylinV10\u3002<\/p>\n\n\n\n
kylinV10 sp2 x86_64: https:\/\/pan.baidu.com\/s\/1-pg76mcXLn8rWP22Adr1iA?pwd=lwjk<\/a> \u63d0\u53d6\u7801: lwjk<\/p>\n\n\n\n nginx: https:\/\/nginx.org\/download\/nginx-1.24.0.tar.gz<\/a><\/p>\n\n\n\n php: https:\/\/www.php.net\/distributions\/php-8.3.3.tar.gz<\/a><\/p>\n\n\n\n pg:https:\/\/ftp.postgresql.org\/pub\/source\/v16.2\/postgresql-16.2.tar.gz<\/a><\/p>\n\n\n\n timescaledb:https:\/\/codeload.github.com\/timescale\/timescaledb\/tar.gz\/refs\/tags\/2.13.1<\/a><\/p>\n\n\n\n zabbix:https:\/\/cdn.zabbix.com\/zabbix\/sources\/development\/7.0\/zabbix-7.0.0beta1.tar.gz<\/a><\/p>\n\n\n\n linux+nginx+postgresql+php<\/p>\n\n\n\n (1) \u672c\u64cd\u4f5c\u793a\u4f8b\u4e2dlinux\u73af\u5883\u4f7f\u7528kylinV10 SP2<\/p>\n\n\n\n (2) \u73af\u5883\u5df2\u914d\u7f6e\u516c\u7f51yum\u6e90<\/p>\n\n\n\n <\/a><\/p>\n\n\n\n \u9009\u62e9nginx\u7248\u672c 1.24.0<\/p>\n\n\n\n (1)\u00a0yum \u5b89\u88c5\u5de5\u5177\u53ca\u73af\u5883\u4f9d\u8d56<\/p>\n\n\n\n # \u7f16\u8bd1\u5de5\u5177\u5b89\u88c5 (2) itops\u7528\u6237\u521b\u5efa# \u7a0b\u5e8f\u7528\u6237itops\u521b\u5efa (3) nginx\u7f16\u8bd1\u64cd\u4f5ctar xf nginx-1.24.0.tar.gz (4) nginx\u914d\u7f6e\u6587\u4ef6\u7f16\u5199 mv \/opt\/nginx\/conf\/nginx.conf \/opt\/nginx\/conf\/nginx.bak (5) nginx\u670d\u52a1\u6587\u4ef6\u7f16\u5199vi \/usr\/lib\/systemd\/system\/nginx.service (6) nginx\u670d\u52a1\u542f\u52a8\u53ca\u81ea\u542fsystemctl enable nginx –now<\/p>\n\n\n\n (7) \u9875\u9762\u8bbf\u95ee\u6d4b\u8bd5<\/p>\n\n\n\n <\/a><\/p>\n\n\n\n \u9009\u62e9postgresql \u7248\u672c16.2<\/p>\n\n\n\n \u9009\u62e9timescaledb \u7248\u672c2.13.1<\/p>\n\n\n\n (1) yum\u5b89\u88c5\u5de5\u5177\u53ca\u73af\u5883\u4f9d\u8d56yum 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<\/p>\n\n\n\n (2) cmake \u5de5\u5177\u5b89\u88c5yum install cmake -y (3) PG\u7f16\u8bd1\u5b89\u88c5# \u7f16\u8bd1PG (4) TS\u65f6\u5e8f\u5e93\u7f16\u8bd1\uff08\u53ef\u9009\uff09tar xf timescaledb-2.13.1.tar.gz (5) pg\u670d\u52a1\u6587\u4ef6\u7f16\u5199vi \/usr\/lib\/systemd\/system\/postgresql.service (6) pg\u670d\u52a1\u542f\u52a8\u53ca\u81ea\u542fsu – itops -c ‘pg_ctl stop’ \u9009\u62e9php\u7248\u672c 8.3.3<\/p>\n\n\n\n (1) yum \u5b89\u88c5\u5de5\u5177\u53ca\u73af\u5883\u4f9d\u8d56oniguruma\u3001oniguruma-devel\u5305(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 \u9009\u62e9zabbix\u7248\u672c 7.0.0beta1<\/p>\n\n\n\n (1) yum \u5b89\u88c5\u7f16\u8bd1\u5de5\u5177\u53ca\u4f9d\u8d56yum -y install libssh2 libssh2-devel OpenIPMI-devel libevent-devel unixODBC unixODBC-devel java-1.8.0-openjdk-devel openssl-devel<\/p>\n\n\n\n (2) zabbix\u7f16\u8bd1\u53ca\u914d\u7f6e\u53c2\u6570\u5b9a\u4e49 tar xf zabbix-7.0.0beta1.tar.gz (3) zabbix\u5e93\u521b\u5efa# \u521b\u5efazabbix\u7528\u6237 <\/a><\/p>\n\n\n\n (4)\u00a0\u6570\u636e\u5e93\u8868\u7ed3\u6784\u5bfc\u5165# \u8fdb\u5165\u7f16\u8bd1\u5305\u6570\u636e\u5e93\u8def\u5f84\u4e0b (1) \u542f\u52a8zabbix_server\/opt\/zabbix\/sbin\/zabbix_server1. lnpp\u5b89\u88c5<\/h3>\n\n\n\n
<\/figure>\n\n\n\n
<\/a><\/figure>\n\n\n\n
1.1. nginx\u5b89\u88c5<\/h3>\n\n\n\n
yum -y install gcc-c++
# nginx \u4f9d\u8d56\u5b89\u88c5
yum -y install pcre-devel openssl-devel<\/p>\n\n\n\n
groupadd itops
useradd -g itops itops
echo Kylin_p@ssw0rd | passwd –stdin itops<\/p>\n\n\n\n
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<\/p>\n\n\n\n
vi \/opt\/nginx\/conf\/nginx.conf
#i#\u8f93\u5165
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;
}
}
}
# \u6d4b\u8bd5nginx\u914d\u7f6e\u683c\u5f0f
chown itops: -R \/opt\/zabbix
\/opt\/nginx\/sbin\/nginx -t<\/p>\n\n\n\n
#i# \u8f93\u5165
[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<\/p>\n\n\n\n<\/a><\/figure>\n\n\n\n
1.2. \u6570\u636e\u5e93\u5b89\u88c5<\/h3>\n\n\n\n
# cmake\u7248\u672c\u9700\u5927\u4e8e3.4\u7248\u672c\uff0c\u5982yum\u65b9\u5f0f\u5b89\u88c5cmake\u7248\u672c\u4f4e\uff0c\u5219\u9700\u8981\u7528\u624b\u52a8\u7f16\u8bd1\u65b9\u5f0f\u8fdb\u884c\u66ff\u6362
cmake –version<\/p>\n\n\n\n
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
# \u521d\u59cb\u5316
mkdir \/data
chown itops: \/data
su – itops
\/opt\/postgresql\/bin\/initdb -D \/data\/postgresql -E utf8
# \u542f\u52a8
\/opt\/postgresql\/bin\/pg_ctl -D \/data\/postgresql\/ start
# \u8bbe\u5b9a\u5168\u5c40\u53d8\u91cf
vim \/etc\/profile
#i # \u5c3e\u884c\u8ffd\u52a0\u5982\u4e0b\u90e8\u5206
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
# \u6267\u884c\u5982\u4e0b\u547d\u4ee4\u4f7f\u53d8\u91cf\u751f\u6548
source \/etc\/profile<\/p>\n\n\n\n
cd timescaledb-2.13.1\/
echo y | .\/bootstrap -DREGRESS_CHECKS=OFF
cd .\/build && make
make install
# PG\u914d\u7f6e\u8f7d\u5165ts\u6a21\u5757
echo “shared_preload_libraries = ‘timescaledb'” >> \/data\/postgresql\/postgresql.conf
# \u91cd\u542fpg\u4ee4\u6a21\u5757\u751f\u6548
su – itops -c ‘pg_ctl restart’<\/p>\n\n\n\n
#i# \u8f93\u5165
[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<\/p>\n\n\n\n
systemctl enable postgresql –now<\/p>\n\n\n\n1.3. php\u5b89\u88c5<\/h3>\n\n\n\n
cp -frp \/usr\/lib64\/libldap* \/usr\/lib\/
yum install oniguruma-*
# \u7f16\u8bd1\u5b89\u88c5php
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
# \u914d\u7f6ephp\u76f8\u5173\u53c2\u6570
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
# \u751f\u6210php-fpm\u542f\u52a8\u6587\u4ef6
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<\/p>\n\n\n\n2. zabbix\u5b89\u88c5\u53ca\u542f\u52a8<\/h2>\n\n\n\n
2.1. zabbix \u7f16\u8bd1\u5b89\u88c5<\/h3>\n\n\n\n
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
# \u6587\u4ef6\u6700\u540e\u8ffd\u52a0\u5982\u4e0b\u884c
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<\/p>\n\n\n\n
su – itops -c ‘createuser –pwprompt zabbix’
# \u8f93\u5165\u7528\u6237\u5bc6\u7801
# \u521b\u5efazabbix\u5e93
su – itops -c ‘createdb -O zabbix -E Unicode -T template0 zabbix’<\/p>\n\n\n\n<\/a><\/figure>\n\n\n\n
cd zabbix-7.0.0beta1\/database\/postgresql\/
# \u5bfc\u5165\u8868\u7ed3\u6784
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’
# \u5173\u95ed\u538b\u7f29\uff0c\u5982\u679c\u9700\u8981\u6b63\u5e38\u538b\u7f29\uff0c\u5219\u8df3\u8fc7\u4e0b\u65b9sed\u547d\u4ee4
sed -i ‘s#compression_status=1#compression_status=0#g’ timescaledb\/schema.sql
cat timescaledb\/schema.sql | \/opt\/postgresql\/bin\/psql -Uzabbix zabbix
# \u629b\u51fa TimescaleDB is configured successfully \u5373\u89c6\u4e3a\u8d85\u8868\u521b\u5efa\u6210\u529f\uff0c\u5176\u4f59\u63d0\u793a\u4fe1\u606f\u53ef\u5ffd\u7565<\/p>\n\n\n\n<\/figure>\n\n\n\n
2.2. zabbix \u670d\u52a1\u53caagent\u7a0b\u5e8f\u542f\u52a8<\/h3>\n\n\n\n
ss -lnt<\/p>\n\n\n\n<\/a><\/figure>\n\n\n\n