Building Zabbix agent - linux-on-ibm-z/docs GitHub Wiki

Building Zabbix agent

Below versions of Zabbix agent are available in respective distributions at the time of creation of these build instructions:

  • RHEL (8.6, 8.8, 8.9, 9.0, 9.2, 9.3) have 6.0.25
  • SLES 15 SP5 has 4.0.50
  • Ubuntu 20.04 has 4.0.17
  • Ubuntu 22.04 has 5.0.17
  • Ubuntu 23.10 has 6.0.14

The instructions provided below specify the steps to build Zabbix agent version 6.0.25 on Linux on IBM Z for following distributions:

  • RHEL (7.8, 7.9)
  • SLES (12 SP5, 15 SP5)
  • Ubuntu (20.04, 22.04, 23.10)

Important Notes:

  • Zabbix-agent version 6.0.25 is available in RHEL (8.6, 8.8, 8.9, 9.0, 9.2, 9.3). However, it is not available in the default repositories, but can be obtained by enabling the EPEL repositories. This can be done by installing the epel-release package:

    • RHEL (8.6, 8.8, 8.9)
    sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
    sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    • RHEL (9.0, 9.2, 9.3)
    sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
    sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
  • epel-release must be installed before attempting to install zabbix-agent.

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Step 1: Build using script

If you want to build Zabbix agent using manual steps, go to STEP 2.

Use the following commands to build Zabbix agent using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Zabbix/6.0.25/build_zabbixagent.sh

# Build zabbix agent
bash build_zabbixagent.sh

If the build completes successfully, Zabbix agent is started. In case of error, check Note at the end of this recipe or logs for more details or go to STEP 2 to follow manual build steps.

Step 2: Install dependencies

export SOURCE_ROOT=/<source_root>/
  • RHEL (7.8, 7.9)

    sudo yum install -y tar wget make gcc pcre-devel
    
  • SLES (12 SP5, 15 SP5)

    sudo zypper install -y tar wget make gcc awk pcre-devel
    
  • Ubuntu (20.04, 22.04, 23.10)

    sudo apt-get update
    sudo apt-get -y install tar wget make gcc libpcre3-dev
    

Step 3: Download and install Zabbix agent

  • Download Zabbix agent

    cd $SOURCE_ROOT
    wget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.25.tar.gz
    tar -xzf zabbix-6.0.25.tar.gz
    
  • Install Zabbix agent

    cd $SOURCE_ROOT/zabbix-6.0.25
    export CFLAGS="-std=gnu99"
    ./configure --enable-agent
    make
    sudo make install
    

Step 4: Post installation steps

  • Create a zabbix user required to start Zabbix agent daemon

     sudo groupadd zabbix
     sudo useradd -g zabbix zabbix
    
  • Edit Zabbix agent configuration file /usr/local/etc/zabbix_agentd.conf

  • Add Zabbix server IP address beside Server= and enter the hostnames as configured on the server beside Hostname=

  • Start Zabbix agent

    export PATH=$PATH:/usr/local/sbin/:/usr/local/bin/
    zabbix_agentd
    

Note: If you get an error " cannot open "/tmp/zabbix_agentd.log" ", change file permissions of Zabbix agent log file using the command sudo chmod 766 /tmp/zabbix_agentd.log and start Zabbix agent again.

  • Verify the installed Zabbix agent version with the following command:

    zabbix_get -s <host_ip> -k "agent.version"
    

Reference:

⚠️ **GitHub.com Fallback** ⚠️