Luke Cyca .com
Zabbix for Mac

HOWTO Install Zabbix 1.6 on Mac OS X 10.5

I wanted a local copy of Zabbix to test and hack on, so I installed it on my mac. It's not as brain-dead easy as it should be, so here are the steps.

1. Install PostgreSQL 8.3.3

This couldn't be easier. Go and download the click-through installer. Choose all the defaults and let it do its thing. It'll make you restart your computer. Remember the superuser password you enter at this step.

2. Compile & Install Zabbix

For this step, you'll need to install Apple's developer tools.

Go download the Zabbix sources and untar them.

Navigate to the directory and run the configure command. Depending on what strikes your fancy, you might enable more options like --with-ipmi or --enable-agent or --with-jabber.

$ ./configure --enable-server --with-pgsql=/Library/PostgreSQL/8.3/bin/pg_config --with-net-snmp --with-libcurl --prefix=$$HOME/Library/Zabbix

Unfortunately it won't compile on Mac OS X. Fortunately this guy figured out why.

Edit include/common.h and right after the following line...

#define ZABBIX_COMMON_H

...add this line...

#define MAXDNAME 2048

Edit include/sysinc.h and replace this line...

#include <resolv.h>

...with this line...

#include <resolv8_compat.h>

Now build it...

$ make -j3

And install it...

$ make install

3. Set up the database

Create a new database user. Choose a database user password. I chose al9a0941h9.

$ /Library/PostgreSQL/8.3/bin/createuser zabbix --no-superuser
--createdb --no-createrole --pwprompt -U postgres
Enter password for new role: <database user password>
Enter it again: <database user password>
Password: <superuser password>

4. Create a new database

$ /Library/PostgreSQL/8.3/bin/createdb zabbix -U zabbix -W
Password: <database user password>

Populate the database with tables and data...

$ cat create/schema/postgresql.sql | /Library/PostgreSQL/8.3/bin/psql -U zabbix -W
Password for user zabbix: <database user password>
...
$ cat create/data/data.sql | /Library/PostgreSQL/8.3/bin/psql -U zabbix -W
Password for user zabbix: <database user password>
...
$ cat create/data/images_pgsql.sql | /Library/PostgreSQL/8.3/bin/psql -U zabbix -W
Password for user zabbix: <database user password>
...

5. Configure the zabbix server

$ mkdir ~/Library/Zabbix/etc
$ cp misc/conf/zabbix_server.conf ~/Library/Zabbix/etc/

Edit ~/Library/Zabbix/etc/zabbix_server.conf. Leave everything as default, but change the following two values...

DBUser=zabbix
DBPassword=al9a0941h9

Start the zabbix server...

./zabbix_server --config=$$HOME/Library/Zabbix/etc/zabbix_server.conf

6. Install & Configure MAMP

MAMP is the quickest way to get a full-blown Apache up and running with PHP5. Download it here and install the regular (non-pro) version.

Configure PHP by editing /Applications/MAMP/conf/php5/php.ini. Change...

max_execution_time = 300

Then go to the bottom of the file and add your timezone

date.timezone = America/Vancouver

Install the Zabbix front-end so MAMP can serve it

$ mv frontends/php ~/Library/Zabbix/frontend
$ ln -s ~/Library/Zabbix/frontend /Applications/MAMP/htdocs/zabbix

7. Launch MAMP & Configure Zabbix front-end

Double-click the main MAMP application and see that the servers start up.

Navigate to http://localhost:8888/zabbix/

Go through the configuration screens.

On the database screen, choose PostgreSQL, set the username to "zabbix" and the password to whatever database user password you chose.

On the zabbix server details screen, set the port to 8888.

You can now log on in with the username/password of Admin/zabbix

Notes on Security

This is a test installation on my home network, so I've foregone best practices for security and reliability. If you are relying on this zabbix installation for a production environment, you should consider taking some precautions...

  • PostgreSQL and Zabbix should both run as separate users
  • Zabbix should be started at boot via launchd
  • In order for launchd to monitor Zabbix, the zabbix_server process should not background itself. I don't think this is currently possible without changing the server's source code.
  • Don't use MAMP for a production service. Configure Apache and PHP properly to start up at boot and run as a separate user.
Luke Cyca .com