Zabbix 8.0升级/部署问题汇总
问题1:编译报错“snmp.c:21:11: fatal error: net-snmp/net-snmp-config.h: No such file or directory”
编译参数
./configure -prefix=/usr/local/zabbix -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp=/usr/local/snmp/bin/net-snmp-config -with-libcurl -with-mysql=/usr/local/mysql/bin/mysql_config -with-libxml2编译错误信息
snmp.c:21:11: fatal error: net-snmp/net-snmp-config.h: No such file or directory
# include <net-snmp/net-snmp-config.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:473: snmp.o] Error 1
make[3]: Leaving directory '/root/zabbix-8.0.0/src/libs/zbxsnmp'
make[2]: *** [Makefile:659: all-recursive] Error 1
make[2]: Leaving directory '/root/zabbix-8.0.0/src/libs'
make[1]: *** [Makefile:517: all-recursive] Error 1
make[1]: Leaving directory '/root/zabbix-8.0.0/src'
make: *** [Makefile:570: all-recursive] Error 1解决方法
安装SNMP开发包
CentOS/RHEL/Rocky
yum install -y net-snmp-devel
或者dnf install -y net-snmp-devel
Debian/Ubuntuapt install -y libsnmp-dev
问题2:MySQL8.0升级8.4后启动Zabbix Server报错
错误信息
zabbix_server[5843]: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.21: cannot open shared object file: No such file or directory解决方法
重新编译安装Zabbix,指定MySQL链接库,编译参数如下
MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
MYSQL_LFLAGS=$($MYSQL_CONFIG --libs | tr ' ' '\n' | grep '^-L' | sort -u | tr '\n' ' ')
MYSQL_RPATH=$($MYSQL_CONFIG --libs | tr ' ' '\n' | grep '^-L' | sort -u | sed 's|^-L|-Wl,-rpath,|' | tr '\n' ' ')
./configure -prefix=/usr/local/zabbix -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp=/usr/local/snmp/bin/net-snmp-config -with-libcurl --with-mysql="$MYSQL_CONFIG" LDFLAGS="$MYSQL_LFLAGS $MYSQL_RPATH" -with-libxml2问题3:编译报错“cannot find pkg-config package for libpcre2”
configure: error: cannot find pkg-config package for libpcre2解决方法
安装PCRE2正则库的开发包
Debian/Ubuntuapt install libpcre2-dev
CentOS/RHEL/Rockyyum install pcre2-devel