Esta sección muestra como compilar los binarios del Zabbix macOS agent desde el código fuente con o sin TLS.
Necesitará herramientas de desarrollo de línea de comandos (Xcode no es necesario), Automake, pkg-config y PCRE (v8.x) o PCRE2 (v10.x). Si desea compilar binarios de agente con TLS, también necesitará OpenSSL o GnuTLS.
Para instalar Automake y pkg-config, necesitará un administrador de paquetes Homebrew desde https://brew.sh/. Para instalarlo, abra la terminal y ejecute el siguiente comando:
Luego instale Automake y pkg-config:
La preparación de las bibliotecas PCRE, OpenSSL y GnuTLS depende de la forma en que se vincularán al agente.
Si tiene la intención de ejecutar archivos binarios del agente en una máquina macOS que ya tiene estas bibliotecas, puede usar bibliotecas precompiladas que proporciona Homebrew. Por lo general, se trata de máquinas macOS que usan Homebrew para compilar archivos binarios del agente Zabbix o para otros fines.
Si se usarán archivos binarios del agente en máquinas macOS que no tienen la versión compartida de las bibliotecas, debe compilar bibliotecas estáticas desde las fuentes y vincular el agente Zabbix con ellas.
Instale PCRE2 (en caso de ser necesario, reemplace pcre2 con pcre en los siguientes comandos):
Cuando se compila con TLS, instale OpenSSL y/o GnuTLS:
Descargue el código fuente de Zabbix:
Compilar el agente sin TLS:
cd zabbix
       ./bootstrap.sh
       ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6
       make
       make installCompilar el agente con OpenSSL:
cd zabbix
       ./bootstrap.sh
       ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-openssl=/usr/local/opt/openssl
       make
       make installCompilar el agente con GnuTLS:
cd zabbix-source/
       ./bootstrap.sh
       ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-gnutls=/usr/local/opt/gnutls
       make
       make installSupongamos que las bibliotecas estáticas PCRE se instalaron en $HOME/static-libs. Usaremos PCRE2 10.39.
Descargue y cree PCRE con soporte de propiedades Unicode:
mkdir static-libs-source
       cd static-libs-source
       curl --remote-name https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz
       tar xf pcre2-10.39.tar.gz
       cd pcre2-10.39
       ./configure --prefix="$PCRE_PREFIX" --disable-shared --enable-static --enable-unicode-properties
       make
       make check
       make installDescargue el código fuente de Zabbix y el agente de compilación:
git clone https://git.zabbix.com/scm/zbx/zabbix.git
       cd zabbix
       ./bootstrap.sh
       ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre2="$PCRE_PREFIX"
       make
       make installAl crear OpenSSL, se recomienda ejecutar make test después de una creación exitosa. Incluso si la creación fue exitosa, las pruebas a veces fallan. Si este es el caso, se deben investigar y resolver los problemas antes de continuar.
Supongamos que PCRE y las bibliotecas estáticas de OpenSSL se instalarán en $HOME/static-libs. Usaremos PCRE2 10.39 y OpenSSL 1.1.1a.
Construyamos bibliotecas estáticas en static-libs-source:
Descargue y compile PCRE con compatibilidad con propiedades Unicode:
curl --remote-name https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz
       tar xf pcre2-10.39.tar.gz
       cd pcre2-10.39
       ./configure --prefix="$PCRE_PREFIX" --disable-shared --enable-static --enable-unicode-properties
       make
       make check
       make install
       cd ..Descargar y compilar OpenSSL:
curl --remote-name https://www.openssl.org/source/openssl-1.1.1a.tar.gz
       tar xf openssl-1.1.1a.tar.gz
       cd openssl-1.1.1a
       ./Configure --prefix="$OPENSSL_PREFIX" --openssldir="$OPENSSL_PREFIX" --api=1.1.0 no-shared no-capieng no-srp no-gost no-dgram no-dtls1-method no-dtls1_2-method darwin64-x86_64-cc
       make
       make test
       make install_sw
       cd ..Descargar el código fuente de Zabbix y compilar el agente:
git clone https://git.zabbix.com/scm/zbx/zabbix.git
       cd zabbix
       ./bootstrap.sh
       ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre2="$PCRE_PREFIX" --with-openssl="$OPENSSL_PREFIX"
       make
       make installGnuTLS depende del backend criptográfico de Nettle y de la biblioteca aritmética GMP. En lugar de utilizar la biblioteca GMP completa, esta guía utilizará mini-gmp que está incluida en Nettle.
Al compilar GnuTLS y Nettle, se recomienda ejecutar make check después de una compilación exitosa. Incluso si la compilación fue exitosa, las pruebas a veces fallan. Si este es el caso, se deben investigar y resolver los problemas antes de continuar.
Supongamos que las bibliotecas estáticas PCRE, Nettle y GnuTLS se instalarán en $HOME/static-libs. Usaremos PCRE2 10.39, Nettle 3.4.1 y GnuTLS 3.6.5.
PCRE_PREFIX="$HOME/static-libs/pcre2-10.39"
       NETTLE_PREFIX="$HOME/static-libs/nettle-3.4.1"
       GNUTLS_PREFIX="$HOME/static-libs/gnutls-3.6.5"Construyamos bibliotecas estáticas en static-libs-source:
Descargue y compile Nettle:
curl --remote-name https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz
       tar xf nettle-3.4.1.tar.gz
       cd nettle-3.4.1
       ./configure --prefix="$NETTLE_PREFIX" --enable-static --disable-shared --disable-documentation --disable-assembler --enable-x86-aesni --enable-mini-gmp
       make
       make check
       make install
       cd ..Descargar y compilar GnuTLS:
curl --remote-name https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz
       tar xf gnutls-3.6.5.tar.xz
       cd gnutls-3.6.5
       PKG_CONFIG_PATH="$NETTLE_PREFIX/lib/pkgconfig" ./configure --prefix="$GNUTLS_PREFIX" --enable-static --disable-shared --disable-guile --disable-doc --disable-tools --disable-libdane --without-idn --without-p11-kit --without-tpm --with-included-libtasn1 --with-included-unistring --with-nettle-mini
       make
       make check
       make install
       cd ..Descargar el código fuente de Zabbix y el agente de compilación:
git clone https://git.zabbix.com/scm/zbx/zabbix.git
       cd zabbix
       ./bootstrap.sh
       CFLAGS="-Wno-unused-command-line-argument -framework Foundation -framework Security" \
       > LIBS="-lgnutls -lhogweed -lnettle" \
       > LDFLAGS="-L$GNUTLS_PREFIX/lib -L$NETTLE_PREFIX/lib" \
       > ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre2="$PCRE_PREFIX" --with-gnutls="$GNUTLS_PREFIX"
       make
       make install