summarize Zabbix agent 2 is a new generation of Zabbix agent that can be used in place of Zabbix agent.Zabbix agent 2 has been developed for:
- Reduce the number of TCP connections
- Provide improved check concurrency
- Easy Extension with Plugins
- Provides simple checks consisting of only a few simple lines of code
- Provide complex checks consisting of long-running scripts and independent data collection with regular data returns
- is a direct replacement for the Zabbix agent (as it supports all previous features)
Agent 2 is written in the Go programming language (reusing some C code from the Zabbix agent).Building Zabbix Agent 2 requires a configured Go environment with a currently supported version of Go Official Documentation Portal
Configuring the Go Environment
wget https://dl.google.com/go/go1.19.5.linux-amd64.tar.gztar -xvf go1.19.5.linux-amd64.tar.gz -C /usr/local/echo "export PATH=/opt/go/bin:$PATH" >> /etc/profile.d/go.shecho "export GO111MODULE=on" >> /etc/profile.d/go.shecho "export GOPROXY=https://goproxy.cn,direct" >> /etc/profile.d/go.shsource /etc/profileConfiguring and compiling the zabbix-agent2 installation environment
(1)、Installing the pcre library yum install pcre-devel (2)、Upgrading the GCC version
⚠️ 注意 Note: Compiling and installing zabbix-agent2 with gcc 4.8.5 results in the following errors
/opt/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1/usr/bin/ld: cannot find -lzcollect2: error: ld returned 1 exit statusGCC upgraded to 12.2 and this issue has been resolved.
Compile and install zabbix-agent2
cd zabbix-6.2.1./configure --prefix=/usr/local/zabbix_agentd2 --enable-agent2make && make installConfigure zabbix-agent2 startup scripts
cp /usr/local/src/zabbix-6.2.1/misc/init.d/fedora/core/zabbix_agentd \/usr/local/zabbix_agentd2/script/Note: The installation path is not the same, you need to edit the zabbix_agentd script to set the correct installation pathCentos 7 compile and install zabbix-agent2
https://huoshen.pages.dev/p/2f4d52e7/