openbsd-ports/net/zabbix/files
ajacoutot 175b28a355 - -main and -doc subpackages do not change whatever flavor is used, so
use fullpkgname
"definitely" ok for sthen@

- while here, fix some substitutions, ownerships and a typo (reported by
jdixon@)
2009-07-13 17:13:01 +00:00
..
README.OpenBSD - -main and -doc subpackages do not change whatever flavor is used, so 2009-07-13 17:13:01 +00:00
zabbix.conf
zabbix.ini

$OpenBSD: README.OpenBSD,v 1.3 2009/07/13 17:13:01 ajacoutot Exp $

This document gives information relevant to using ZABBIX on OpenBSD.
The original documentation is available as a PDF file at
    ${HOMEPAGE}
(or via the -doc subpackage of the zabbix port) but may not be
redistributed. 

On OpenBSD, ZABBIX is packaged in four parts:

- the agent (in the zabbix-agent package) for installing onto a
monitored machine. To simplify installation from ports on client
machines, only this part is built by default.

- the server and proxy (in the database-dependent zabbix-server
package); this has heavier dependencies and is built by selecting
the FLAVOR for the database you use (currently mysql or pgsql).

- the web interface to run with the server (in the zabbix-web package).
This is also in a database-dependent package to ensure the correct
PHP modules are installed.

- the PDF document, a package which must be 'built' locally because it
can not be redistributed.

Next, you have to adapt the configuration files under
    ${SYSCONFDIR}/zabbix/

To have the ZABBIX server start at boot time, insert the following into
/etc/rc.local:

if [ -x ${TRUEPREFIX}/sbin/zabbix_server ]; then
	install -d -o _zabbix /var/run/zabbix
	echo -n ' zabbix_server'; ${TRUEPREFIX}/sbin/zabbix_server
fi

For the proxy and the client, follow the same procedure, replacing
zabbix_server with zabbix_proxy or zabbix_clientd.

The web frontend works reasonably well with OpenBSD's chroot'ed
httpd (the "Status of ZABBIX" page uses /bin/ps and /dev/kmem to
check the process, so it erroneously reports it as not running).
Some changes from the default configuration are required -
you can do this by creating symbolic links as follows:

# ln -s ${PREFIX-web}/conf/modules.sample/zabbix.conf \
        ${PREFIX-web}/conf/modules

# ln -fs ${PREFIX-web}/conf/php5.sample/zabbix.ini \
        ${PREFIX-web}/conf/php5/zabbix.ini

ZABBIX requires a timezone to be configured in PHP; zabbix.ini
sets this to UTC, you may like to adjust this. After making these
changes, stop and start httpd.

Next you must create the database following the relevant set of
instructions below. When this is done you can proceed to configure
through the web interface at http://<hostname>/zabbix/setup.php.
(default user is 'admin' with password 'zabbix')

== MySQL ==

MySQL users running with chroot'ed httpd might like to take the
following steps to place the mysql socket inside the chroot:

Create a directory for the mysql socket.

        mkdir -p /var/www/var/run/mysql

Adjust ${SYSCONFDIR}/my.cnf to put the mysql socket into the chroot,

        [client]
        socket = /var/www/var/run/mysql/mysql.sock

        [mysqld]
        socket = /var/www/var/run/mysql/mysql.sock

and set DBSocket in the ZABBIX configuration appropriately.

Connect to MySQL, and create a user and database for ZABBIX;

	$ mysql -u root -p
	mysql> create user zabbix@localhost identified by 'password';
	mysql> create database zabbix;
	mysql> grant all on zabbix.* to zabbix@localhost;
	mysql> quit

Then initialize the database from the files installed in
${TRUEPREFIX}/share/examples/zabbix:

	$ cd ${TRUEPREFIX}/share/zabbix/schema
	$ mysql -uzabbix -p[password] zabbix < mysql.sql
	$ cd ../data
	$ mysql -uzabbix -p[password] zabbix < data.sql	     ## N.B. slow!!
	$ mysql -uzabbix -p[password] zabbix < images_mysql.sql

== PostgreSQL ==

Assuming you have an administrative account named `postgres',
you can create the 'zabbix' user and database like this:

	createuser -U postgres --pwprompt --no-superuser \
	    --createdb --no-createrole zabbix
	createdb -U zabbix zabbix

And initialize the database:

	$ psql -U zabbix
	psql> create database zabbix;
	psql> \q
	$ cd ${TRUEPREFIX}/share/zabbix/schema
	$ cat postgresql.sql | psql -U zabbix zabbix
	$ cd ../data
	$ cat data.sql | psql -U zabbix zabbix
	$ cat images_pgsql.sql | psql -U zabbix zabbix