Throughout this guide, I will layout the steps to install a Zabbix Agent on a Mac OSX Device which can then be monitored by a Zabbix Proxy or Zabbix Server Instance.
This guide will assume that you already have the MAC OSX Device and your Zabbix Instance up and running, along with a basic knowledge of Zabbix.
Step 1: Download the Zabbix Agent Installer
- Go to https://www.zabbix.com/download_agents.
- Select the Download button beside “Mac OS OpenSSL” and save the installer to your downloads folder.
Step 2: Install the Zabbix Agent
- Go to your Downloads folder and run the installer which you downloaded in the previous step.
- Run through the options with the pre-selected options as the default.
Step 3: Edit the Zabbix Agent Configuration File
- Next, you need to edit the Zabbix Configuration file to tell the agent it’s config, run the below command.
sudo nano /usr/local/etc/zabbix/zabbix_agentd.conf
- Uncomment and set the following values.
Server=monitoring.services.education.vic.gov.au
EnableRemoteCommands=1
Hostname=XXXXMACSVRYY
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=XXXXMACSVRYY
TLSPSKFile=/home/zabbix/secret.psk
Press Control + X then Y then Enter to save and close the file.
Step 4: Next you need to create a PSK File on the Zabbix Server Instance and copy to the Agent for encrypted communications. This can be completed with the following instructions.
cd /zabbix-psk-keys/
openssl rand -hex 32 > XXXXMACSVRYY.psk
cat XXXXMACSVRYY.psk
The last command that you ran will show you the contents of the file, which you can then use below…
Step 5: Create the PSK File on the Zabbix Agent Mac OSX Device by running the following commands.
cd /home/
sudo mkdir zabbix
cd ./zabbix/
sudo nano secret.psk
You then need to paste in the PSK string and then press Control + X then Y then Enter to save and close the file.
Step 6: Secure the PSK File so that it can only be accessed by Zabbix services by running the following commands.
sudo chown zabbix:zabbix secret.psk
sudo chmod 640 secret.psk
Step 7: Restart the Zabbix Agent Server
- Mac OSX automatically starts the Zabbix Agent Service on installation.
- However, as we have edited the configuration file, we need to restart the service, to do so, run the following commands.
sudo launchctl unload /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
sudo launchctl load /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
Step 8: Add the Zabbix Agent (Host) to the Central Zabbix Server for monitoring
- So that we can monitor the Mac OSX Device, we need to add the device to the Zabbix Central Server’s Web Interface so that it will tell the corresponding Zabbix Proxy to monitor the device.
- Go to: https://Monitor.JamesMutch.TECH
- Configuration -> Hosts -> Create Host (Top RHS).
- Enter the following details on the Host tab:
- Name: XXXXMACSVRYY
- Groups: XXXX/YY/Servers – Physical
- Agent Interfaces: IP of DEVICE (Enter the IP address of the Mac OSX device to be monitored)
- Monitored by Proxy: Select the site proxy server from the drop-down.
- Enter the following details on the Templates tab:
- Link new Templates:
- Template OS MAC OS X
- Template macOS Content Cache (If it’s a content cache)
- Click on the little blue Add button below the list to add the templates to the host.
- Link new Templates:
- Enter the following details on the Inventory tab:
- Select Automatic in the top options.
- Enter the following details on the Encryption tab:
- Connections to host: PSK
- Connections from host: Make sure than only PSK is ticked.
- PSK Identity: XXXXMACSVRYY
- PSK: Enter in the contents of the PSK File we created earlier on the server.PSK
- Click the Add button along the button to add the Host to Zabbix.
CONGRATULATIONS
You have now completed the installation of the Zabbix Agent on a Mac OSX Device and have successfully added these the device to the Zabbix Central Server for monitoring.
Check out my guide on setting up a Zabbix Proxy if you haven’t already set up a Zabbix Proxy for your site here.
As always, thanks for looking through this guide and until next time happy learning!
Comments: