Ad Widget

Collapse

Problems building MacOS Zabbix 6.0 agent for M1 architecture

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ken.riggleman
    Junior Member
    • Jan 2022
    • 5

    #1

    Problems building MacOS Zabbix 6.0 agent for M1 architecture

    Given M1 architecture is Apple's direction for the future, sure would be nice if a precompiled agent were available for that architecture.

    Given that's not the case, I tried to follow the directions in Zabbix "installation from sources" documentation: Building Zabbix agent on macOS

    However, despite multiple attempts, the command git clone https://git.zabbix.com/scm/zbx/zabbix.git

    always fails with the following:

    Cloning into 'zabbix'...
    remote: Enumerating objects: 1034134, done.
    remote: Counting objects: 100% (1034134/1034134), done.
    remote: Compressing objects: 100% (189551/189551), done.
    error: RPC failed; curl 18 transfer closed with outstanding read data remaining
    error: 231 bytes of body are still expected
    fetch-pack: unexpected disconnect while reading sideband packet
    fatal: early EOF
    fatal: fetch-pack: invalid index-pack output

    Alternatively, I am able to download the 6.0.2 source and tar expand the source files.
    However, there is no bootstrap.sh anywhere in source files so I'm not able to follow the provided build instructions.

    Can anyone provide advice?
    I have homebrew installed and was able to follow the instructions up to the git clone without issue. I tried following instructions on another Mac with amd64 architecture and git clone failed in exactly same way.
    Can I build from source without using ./bootstrap.sh as instructed?
    Last edited by ken.riggleman; 24-03-2022, 00:07.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Originally posted by ken.riggleman
    However, despite multiple attempts, the command git clone https://git.zabbix.com/scm/zbx/zabbix.git

    always fails with the following:

    Cloning into 'zabbix'...
    remote: Enumerating objects: 1034134, done.
    remote: Counting objects: 100% (1034134/1034134), done.
    remote: Compressing objects: 100% (189551/189551), done.
    error: RPC failed; curl 18 transfer closed with outstanding read data remaining
    error: 231 bytes of body are still expected
    fetch-pack: unexpected disconnect while reading sideband packet
    fatal: early EOF
    fatal: fetch-pack: invalid index-pack output
    So it's weird that the git client is failing, seems like it's something in the network transfer (which is using libcurl, apparently). You might want to web search on "fetch-pack: unexpected disconnect while reading sideband packet" (maybe include either 'curl' or 'git' in the searches) to see if someone has come up with what the issue is. Weird network errors like this always make me suspect some incompatibility between the client's encryption libraries and the ones used on the server, but it could be something else.

    In any case, I would actually recommend using the released source code anyway, so the 6.0.2 tarball is where I would probably start. Because the 6.x release is still pretty fresh, it's a fast-moving target, so it's possible that the git clone would have fixes incorporated that the released tarball doesn't, but I still generally start with the released version.

    Originally posted by ken.riggleman
    Alternatively, I am able to download the 6.0.2 source and tar expand the source files.
    However, there is no bootstrap.sh anywhere in source files so I'm not able to follow the provided build instructions.

    Can anyone provide advice?
    I have homebrew installed and was able to follow the instructions up to the git clone without issue. I tried following instructions on another Mac with amd64 architecture and git clone failed in exactly same way.
    Can I build from source without using ./bootstrap.sh as instructed?
    bootstrap.sh generates or regenerates the "configure" script that is used to configure the source code and Makefiles for building on your system. You only need "configure". If it's present, you can try using that, without re-bootstrapping to regenerate configure.

    Sometimes, the source files that go into creating the "configure" script have been adjusted or tailored for your OS, so there are times when you are better off forcing configure to be rebuilt on your OS, just to pick up any local customizations.

    I would start by skipping the bootstrap.sh and trying the configure line that's given in the directions, for building just the agent + IPv6 support. If that configures successfully and builds through to the end, then you're probably in good shape.

    If that doesn't work, though, you might try doing:

    Code:
    make distclean
    aclocal
    automake
    autoconf
    The "make distclean" cleans up any generated files and gets you back to the state the directory is in right after its extracted from the source tarball.

    The aclocal, automake, and autoconf are 3 of the steps that "bootstrap" would do to generate "configure" and the Makefile.in input files. There might be other stuff that bootstrap does (possibly related to libtool, international files, etc.), but you can often get away with just the "aclocal; automake; autoconf" step.

    Good luck!

    Comment

    • ken.riggleman
      Junior Member
      • Jan 2022
      • 5

      #3
      Thanks Tim for excellent advice! Given your feedback I was able to at least get zabbix_agentd compiled for M1 architecture. I didn't find the documentation all that great so I'll provide some feedback in that forum. I apparently still don't have plist file created correctly because when I try to start as a service it gets permission errors trying to create /tmp/*.pid files. I am at least able to run zabbix_agentd manually, so that's progress. I had to make several adjustments different from documentation to get to a successful compile so I'll give that feedback soon. I did want to at least reply now and provide my much appreciated thanks for your explanation! I was definitely stuck otherwise.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        M1 is still quite new platform, not so widespread, I guess. And expensive as hell: (well which apple product isn't...) As with many other cases (installation packages for different platforms/versions etc), if someone can provide a platform for devs, they could provide some results..

        Comment

        • ken.riggleman
          Junior Member
          • Jan 2022
          • 5

          #5
          Point well taken. That is why we ourselves have only one M1 server and it has a heavy production load on it with critical business functions (thus the need to monitor). I wasn't all that comfortable even loading HomeBrew on it, but I didn't have a choice.
          On the other hand, my build experience was exactly the same on an entry level amd based MacBook running MacOS Monterey (Version 12). I did practice there first. Apparently, Homebrew defaults on recent MacOS versions have changed some since Zabbix build doc was written. I attempted to provide specific feedback in Documentation/support forum, but it appears my options there are limited, so I'll document here for benefit of anyone else attempting this.

          I attempted to follow the instructions at https://www.zabbix.com/documentation...tall/mac_agent to build MacOS zabbix agent.
          I was able to install HomeBrew and perform all the documented brew install ... steps
          When I got to "git clone https://git.zabbix.com/scm/zbx/zabbix.git" command, I got the errors documented above, both on my MacBook with amd architecture as well as M1 server, both running Monterey.
          Thanks to Tim's advice, he made me realize using git clone wasn't necessarily the same as downloading 6.0.2 sources of the latest stable release. So, I didn't want to use git clone anyway.

          Once I expanded the tar ball, given I wanted to link with openSSL, I ended up needing to run the following:
          ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --with-openssl=/opt/homebrew/opt/openssl --with-libpcre=/opt/homebrew/opt/pcre
          sudo make install


          Note that I left out --enable-ipv6 because I was using internally with a pure IPv4 network. Anyone using IPV6 would obviously want to include that as well.
          Thanks, again to Tim's advice above, I realized the "./bootstrap.sh" step wasn't needed if I had downloaded source and expanded with "tar -zxvf zabbix-6.0.?.tar" as documented here.

          That at least got me to a successful build of /usr/local/sbin/zabbix_agentd

          Documentation for other postinstall steps normally performed by pkg install are noticeably missing from doc. I tried extracting and running the postinstall script from the amd pkg file but that didn't work. I'll document here further once I successfully navigate remaining steps.
          Last edited by ken.riggleman; 25-03-2022, 23:00.

          Comment


          • tim.mooney
            tim.mooney commented
            Editing a comment
            I'm not all that familiar with Apple's modern package format, but I have a *lot* of experience with packaging software on Linux and elsewhere. For most other platforms I'm familiar with, there are tools to take a vendor provided package and extract components from it.

            In this case, I'm wondering if you could download the official Mac agent package and extract anything else that's not the zabbix_agentd binary, and then use that with your M1-compatible binary. For example, on Linux you could extract the systemd service file for the agent and use that, either as an example or with your own custom binaries.

            I'm just wondering if it's possible to use the *rest* of the Zabbix package, but with your binary, to get the service startup and other stuff working in a robust fashion.

            Alternately, you could browse the github/gitlab/whatever source repository and hunt around in there, to see if you can find the extra files that go into building the package. If you know what to look for, you might be able to find the service startup file and other components there.
        Working...