Update as of 16/04/18
Create a service user: zabbix
Check if the gid you will use, is still available, for users: sudo dscl . -list /Users UniqueID
Groups: sudo dscl . -list /Groups UniqueID
sudo dscl . -create /Groups/zabbix gid 301 sudo dscl . -create /Groups/zabbix RealName “Zabbix Server Group" sudo dscl . -create /Groups/zabbix passwd "*" sudo dscl . -create /Users/zabbix sudo dscl . -create /Users/zabbix uid 301 sudo dscl . -create /Users/zabbix gid 301 sudo dscl . -create /Users/zabbix NFSHomeDirectory /var/empty sudo dscl . -create /Users/zabbix UserShell /usr/bin/false sudo dscl . -create /Users/zabbix RealName "Zabbix Server" sudo dscl . -create /Users/zabbix passwd "*"
For zabbix clients 3.4 on mac os, we’ll also need PCRE as noted here https://www.zabbix.com/documentation/3.4/manual/installation/install
Switch to Download folder of current user and download the source package.
cd /Downloads
curl --remote-name ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
Extract the archive and move into the folder.
tar -xzvf pcre-8.41.tar.gz
sudo mv pcre-8.41 /etc/pcre-8.41
Configure, compile and install into /etc/pcre-8.41
sudo ./configure --prefix=/etc/pcre-8.41
sudo make
sudo make install
Create a symbolic link to /usr/local/pcre.
sudo ln -s /etc/pcre-8.41 /usr/local/pcre
We’ll need xcode for zabbix to compile on a Mac osx server (so once compiled you can skip this step, until and including the line “./configure –enable-agent”. Just copy the already compiled agent from an existing mac osx)
command-line tools:
xcode-select --install
Download zabbix source code: https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.0/zabbix-3.2.0.tar.gz/download (http://www.zabbix.com/download.php)
Untar
cd /Users/administrator/Downloads (or whatever) curl -L https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.7/zabbix-3.4.7.tar.gz/download -o zabbix-3.4.7.tar.gz tar -zxvpf zabbix-3.4.7.tar.gz
Switch to the tarball directory
cd zabbix-3.4.7
Make the installation directories and run the configure script with the –enable-agent switch
sudo mkdir -p /usr/local/etc /usr/local/sbin sudo ./configure --enable-agent --with-libpcre=/etc/pcre-8.41 sudo make sudo make install
Copy the configuration file to the local etc directory:
sudo cp ./conf/zabbix_agentd.conf /usr/local/etc/
Copy the daemon file to the local sbin directory
sudo cp ./src/zabbix_agent/zabbix_agentd /usr/local/sbin sudo nano /usr/local/etc/zabbix_agentd.conf
Start the agent:
/usr/local/sbin/zabbix_agentd
To autostart the zabbix agent with a reboot of MAC OSX
Make the following file: “/Library/LaunchAgents/org.macports.zabbix_agent.plist”
sudo nano /Library/LaunchAgents/org.macports.zabbix_agent.plist
Contents of the file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.macports.zabbix_agent</string> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>sh</string> <string>/etc/startzabbix.sh</string> </array> </dict> </plist>
test your file with: plutil /Library/LaunchAgents/org.macports.zabbix_agent.plist
Let’s create a startup script for zabbix (yes, i am aware it is “strange” to create a bash file, while i could copy paste the same command directly in the plist file, but i’ve seen, how can i say, various result with different mac os versions, it seems this works best overall on all mac os versions):
sudo nano /etc/startzabbix.sh
which says:
#!/bin/bash /usr/local/sbin/zabbix_agentd
make it runnable:
sudo chmod a+x /etc/startzabbix.sh
Launch the launchctl file with (so you don’t need to reboot to test the plist, no sudo!): launchd /Library/LaunchAgents/org.macports.zabbix_agent.plist
Last: Make the host in zabbix and add the mac template on it.
Also don’t forget to open up port 10050 in the firewall of the mac osx server