Compiling the Agent
The Zabbix Agent for OSX must be compiled from source code, and amazingly no one including Zabbix seems to be offering pre-compiled binaries or packages. There are good instructions for how to do this, including the article: "Install Zabbix Agent on Mac osx", but I got configure errors and so have worked out better instructions.
Here is a OSX binary for download, created in Xcode following the instructions below, for Zabbix v3.2.1 on OSX 10.11.6. It seems to work fine under OSX 10.9.5 so this may or may not work for you: USE AT YOUR OWN RISK. Download (147K). This will allow you to skip the following steps to compile an Agent from source.
- Install Xcode
- Activate the command-line tools for Xcode: $ sudo xcodebuild -license accept
- Download zabbix source code for the version of Zabbix Server you are using. You can find the latest stable version of the source at: http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/
- Decompress the source code and copy to some local working directory, e.g. ~/Documents
- In Terminal, switch to the source code directory, e.g. $ cd ~/Documents/zabbix-3.2.1
- Configure the build: $ ./configure --enable-agent
- Make the binary: $ make
The agent is located at: ./src/zabbix_agent/zabbix_agentd
The conf file is located at: ./conf/zabbix_agentd.conf
Copy the Agent to the Machine To Be Monitored
You should be able to use the compiled Agent on machines running the same or similar version of OSX just by copying the files.
- Create the directories on the workstation to be monitored: $ sudo mkdir -p /usr/local/etc /usr/local/sbin
- Copy the binary and conf file to these directories. (Examples assume installing on same machine as compiled)
$ sudo cp ./src/zabbix_agent/zabbix_agentd /usr/local/sbin/
$ sudo cp ./conf/zabbix_agentd.conf /usr/local/etc/
Edit the Conf File
The conf file determines the capabilities of the Agent. You must edit it to be able to accept connections from a non-local server or to take advantage of any capabilities.
$ sudo nano /usr/local/etc/zabbix_agentd.conf
For a workstation being remotely monitored, at minimum you need to set:
- Server= : to the IP address or hostname of the remote Zabbix server
- Many other settings
Start the Agent
To start the Zabbix Agent: $ /usr/local/sbin/zabbix_agentd
Set the Agent to Auto Launch on Reboot
The Zabbix agent does not like to launch as root, so you have to create a local user for the agent to run as. You can do this from either Server.app, System Preferences, or the command line.
To create a local user in Server.app, create the new user "zabbix_agentd", as a Local user, without email and no home directory.
To create a local user in System Preferences, go to Users & Groups and create a Standard user.
To auto launch the daemon on restart of the workstation create the launchd agent:
$ sudo nano /Library/LaunchDaemons/org.zabbix.zabbix_agent.plist
And paste in the following:
<?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.zabbix.zabbix_agent</string> <key>ProgramArguments</key> <array> <string>/usr/local/sbin/zabbix_agentd</string> </array> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>zabbix-agent</string> </dict> </plist>
Firewall Settings
It may be necessary to open the firewall to the remote server. Zabbix uses port 10050/tcp