2

According to Zabbix agent installation, you can install just the zabbix-agent on macOS with brew install zabbix --without-server-proxy

Nothing explained how to configure the agent, tells him where to send the information ? Is there any configuration file located somewhere ?

There are some files in /usr/local/Cellar/zabbix/<version number>/ but nothing similar to a .conf.

  • 4
    I'm voting to close this question as off-topic because it's a Basic Customer Support question. Please see the meta post linked above for details on how to proceed if you can edit the post and, if put on Hold, have the Hold reviewed. You can also contact the software developer for assistance with their product. – fsb Feb 27 '18 at 17:23
  • I'm going to clear the close votes. there's enough research here to make an answer. Just because you could ask a question of another vendor doesn't make it off topic here. Also, whether the vendor has support or not is moot - it's either meeting our quality or not. Since it's about using third party software with Mac, that's on topic. It's only off topic if there's zero effort to triage or search for an answer. This one clearly knows to look for a .conf file and is answerable by anyone that knows zabbix or can do some light research. – bmike Feb 27 '18 at 20:47
3

Checking brew installer or configure/make messages often help to determine where files and folders are stored or how and where to configure services or apps:

Example output after installing the required dependencies:

...
==> Installing zabbix --without-server-proxy
==> Downloading https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.7/zabbix-3.4.7.tar.gz
==> Downloading from https://10gbps-io.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.7/zabbix-3.4.7.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/zabbix/3.4.7 --sysconfdir=/usr/local/etc/zabbix --enable-agent --with-iconv=/Applications/
==> make install
🍺  /usr/local/Cellar/zabbix/3.4.7: 13 files, 1.4MB, built in 1 minute 31 seconds

One ./configure flag of zabbix is --sysconfdir=/usr/local/etc/zabbix.

Consequently the configuration file(s) and folders (i.e. zabbix_agentd.conf.d) can be found here:

/usr/local/etc/zabbix/

Additional zabbix* man files can be found here:

/usr/local/share/man/man1/
/usr/local/share/man/man8/

Additional steps to perform:

  1. Add /usr/local/sbin to your path. Some brew-installed binaries are installed to this folder (e.g. dnsmasq or zabbix)

  2. Get the zabbix agent to launch at boot time with a launch daemon/agent. I haven't found one accompanying the brew-installed zabbix.

    Several can be found at github though:

    • com.zabbix.zabbix_agentd.plist (the config dir in the plist has to be modified though).
    • zabbix_agentd_osx_installer (either the UserName/GroupName keys have to removed or a User and Group each with the name zabbix have to be added as special user/group with dscl or the Users & Groups prefpane though or the daemon will fail)

      The older zabbix 2.2.5 installer uses the following postinstall script to add a zabbix user & group/modify files and folders:

      #!/usr/bin/env bash
      
      #To create a group:
      sudo dscl /Local/Default -create /Groups/zabbix
      sudo dscl /Local/Default -create /Groups/zabbix PrimaryGroupID 113
      sudo dscl /Local/Default -create /Groups/zabbix Password \*
      
      #To create a user:
      sudo dscl /Local/Default -create /Users/zabbix
      sudo dscl /Local/Default -create /Users/zabbix UniqueID 113
      sudo dscl /Local/Default -create /Users/zabbix UserShell /usr/bin/false
      sudo dscl /Local/Default -create /Users/zabbix RealName 'Zabbix user'
      sudo dscl /Local/Default -create /Users/zabbix NFSHomeDirectory /var/empty 
      sudo dscl /Local/Default -create /Users/zabbix PrimaryGroupID 113
      sudo dscl /Local/Default -create /Users/zabbix Password \*
      
      #Create needed directories 
      sudo mkdir -p /var/run/zabbix-agent
      sudo mkdir -p /var/log/zabbix-agent
      sudo mkdir -p /usr/local/bin
      sudo mkdir -p /usr/local/sbin
      sudo mkdir -p /usr/local/etc/zabbix
      
      sudo chown -Rf zabbix:zabbix /var/run/zabbix-agent
      sudo chown -Rf zabbix:zabbix /var/log/zabbix-agent
      
      sudo chown root:wheel /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
      sudo chown root:wheel /usr/local/etc/zabbix/zabbix_agentd.conf
      sudo chown root:wheel /usr/local/etc/zabbix_agentd.conf
      
      sudo chown -Rf root:wheel /usr/local/sbin
      sudo chown -Rf root:wheel /usr/local/bin
      sudo chmod -Rf 755 /usr/local/bin
      sudo chmod -Rf 755 /usr/local/sbin
      
      sudo chmod 755 /usr/local/etc/zabbix
      #sudo kill -9 `ps aux | grep zabbix_agentd | cut -f11 -d" "`
      #sudo kill -9 `ps -aef | grep zabbix_agentd | grep -v grep | awk '{print $2}'`
      #sudo rm -Rf /tmp/zabbix*
      

      It's not recommended to execute all these steps but the script may serve as an example how to get it to work. Some have already been executed by installing zabbix with brew (e.g. some sudo mkdir ... commands). Some aren't necessary (e.g. some sudo chown root:wheel ... commands) or will even break brew (e.g. sudo chown -Rf root:wheel /usr/local/bin). If you choose to create a zabbix user/group, make sure that the user can read, write and execute files in the /usr/local/etc|sbin|bin branches.

    Move the edited plist file to /Library/LaunchDaemons/ and load it - after editing the zabbix config file - with:

    sudo launchctl load /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist 
    
  • The agent starts automaticly at boot time. To start is manually enter: sudo launchctl load /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist Maybe this could be added in that perfect answer ? – Tolsadus Feb 27 '18 at 19:43
  • @Tolsadus Where did you find the file com.zabbix.zabbix_agentd.plist. It wasn't created/installed by/with brew install zabbix ... here. Did you find it somewhere else? Googling the file name I find several plists at github or somewhere else... – klanomath Feb 27 '18 at 20:21
  • That's probably some parts of github.com/mipmip/zabbix_agentd_osx_installer that I've previously tried to install :( – Tolsadus Feb 27 '18 at 20:32
  • If you're going to go to this much trouble you should invest in ansible to setup the user and group as well as deploy this setup to your other Macs programmatically – Cameron Lowell Palmer May 19 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .