- lot's of zabbix luve by Matthew Weigel, now has flavors for the database backends

and more setup instructions. thanks.
This commit is contained in:
jasper 2009-06-03 17:54:12 +00:00
parent 14798cdaf7
commit 11a8aa2d6d
5 changed files with 162 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2009/05/03 22:32:01 sthen Exp $
# $OpenBSD: Makefile,v 1.5 2009/06/03 17:54:12 jasper Exp $
COMMENT-main = network and application monitoring - agent
COMMENT-server = network and application monitoring - server
@ -7,10 +7,10 @@ COMMENT-doc = network and application monitoring - non-free documentation
VERSION = 1.6.4
DISTNAME = zabbix-${VERSION}
PKGNAME-main = zabbix-agent-${VERSION}p1
PKGNAME-server = zabbix-server-${VERSION}p2
PKGNAME-main = zabbix-agent-${VERSION}p2
PKGNAME-server = zabbix-server-${VERSION}p3
PKGNAME-doc = zabbix-doc-${VERSION}
PKGNAME-web = zabbix-web-${VERSION}p0
PKGNAME-web = zabbix-web-${VERSION}p1
CATEGORIES = net
HOMEPAGE = http://www.zabbix.com/
@ -29,27 +29,25 @@ PERMIT_PACKAGE_FTP-doc = non-free documentation
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=zabbix/}
MULTI_PACKAGES = -server -main -web -doc
MULTI_PACKAGES = -main -doc
PSEUDO_FLAVORS = no_server
FLAVORS = mysql pgsql
SUBST_VARS += PREFIX-web ZABBIX_WEB
WANTLIB = c kvm m
LIB_DEPENDS = lber,ldap::databases/openldap
LIB_DEPENDS-server = ${LIB_DEPENDS} \
curl::net/curl \
netsnmp::net/net-snmp \
mysqlclient::databases/mysql
netsnmp::net/net-snmp
RUN_DEPENDS-server = ::net/fping
WANTLIB-web =
LIB_DEPENDS-web =
RUN_DEPENDS-web = ::www/php5/extensions,-mysql
CONFIGURE_STYLE = gnu
CONFIGURE_ARGS = --enable-server \
--enable-agent \
--enable-proxy \
--enable-ipv6 \
--with-mysql \
--with-libcurl \
--with-net-snmp \
--with-ldap
@ -57,14 +55,47 @@ CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
PREFIX-web = /var/www
ZABBIX_WEB = ${PREFIX-web}/htdocs/zabbix
FLAVOR ?= no_server
#if non-backend-related flavors are added, add them to
#the following line as ":L:Nflavor1:Nflavor2" so that
#they don't trigger a "Conflicting flavors" error.
BACKEND = ${FLAVOR}
.if ${BACKEND} == "mysql"
MULTI_PACKAGES += -server -web
LIB_DEPENDS-server += mysqlclient::databases/mysql,-main
RUN_DEPENDS-web = ::www/php5/extensions,-mysql
CONFIGURE_ARGS += --with-mysql
.elif ${BACKEND} == "pgsql"
MULTI_PACKAGES += -server -web
LIB_DEPENDS-server += pq::databases/postgresql,-main
RUN_DEPENDS-web = ::www/php5/extensions,-pgsql
CONFIGURE_ARGS += --with-pgsql
.elif ${BACKEND} == "no_server"
CONFIGURE_ARGS += --disable-server \
--disable-proxy
.else
ERRORS += "Fatal: Conflicting flavors: ${FLAVOR}";
.endif
post-install:
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX-web}/zabbix
cd ${WRKBUILD}/frontends/php && tar -cf - . | \
tar -C ${DESTDIR}${PREFIX-web}/zabbix -xf -
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/zabbix
${SUBST_CMD} -c ${FILESDIR}/README.OpenBSD \
${PREFIX}/share/doc/zabbix/README.OpenBSD
${INSTALL_DATA} "${WRKBUILD}/docs/ZABBIX Manual v1.6 rev 17.pdf" \
${PREFIX}/share/doc/zabbix/ZABBIX_Manual_v1.6_rev17.pdf
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX-web}/conf/
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX-web}/conf/modules.sample
${SUBST_CMD} -c ${FILESDIR}/zabbix.conf \
${DESTDIR}${PREFIX-web}/conf/modules.sample/zabbix.conf
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX-web}/conf/php5.sample
${SUBST_CMD} -c ${FILESDIR}/zabbix.ini \
${DESTDIR}${PREFIX-web}/conf/php5.sample/zabbix.ini
${INSTALL_DATA_DIR} ${PREFIX}/share/zabbix/schema
${INSTALL_DATA_DIR} ${PREFIX}/share/zabbix/data
${INSTALL_DATA_DIR} ${PREFIX}/share/zabbix/data/images

View File

@ -0,0 +1,111 @@
$OpenBSD: README.OpenBSD,v 1.1 2009/06/03 17:54:12 jasper 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.
To have the ZABBIX server start at boot time, you have to adapt
the configuration file in ${SYSCONFDIR}/zabbix/zabbix_server.conf,
create the directory /var/run/zabbix (owned by the _zabbix user),
and insert the following into /etc/rc.local.
if [ -x ${PREFIX}/bin/zabbix_server ]; then
echo -n ' zabbix'; ${PREFIX}/bin/zabbix_server
fi
For the proxy, follow the same procedure, replacing zabbix_server
with zabbix_proxy.
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://your_machine/zabbix/setup.php.
== 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
create user zabbix@localhost identified by 'password';
create database zabbix;
grant all on zabbix.* to zabbix@localhost;
Then initialize the database from the files installed in
${PREFIX}/share/examples/zabbix:
$ cd ${PREFIX}/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 ${PREFIX}/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

View File

@ -0,0 +1,2 @@
See ${PREFIX}/share/doc/zabbix/README.OpenBSD for information
about configuring and running ZABBIX on OpenBSD.

View File

@ -1,10 +1,12 @@
@comment $OpenBSD: PLIST-main,v 1.2 2009/04/23 15:38:11 jasper Exp $
@comment $OpenBSD: PLIST-main,v 1.3 2009/06/03 17:54:12 jasper Exp $
@newgroup _zabbix:623
@newuser _zabbix:623:_zabbix:daemon:zabbix user:/nonexistent:/sbin/nologin
@bin sbin/zabbix_agent
@bin sbin/zabbix_agentd
@bin sbin/zabbix_get
@bin sbin/zabbix_sender
share/doc/zabbix/
share/doc/zabbix/README.OpenBSD
share/examples/zabbix/
@sample ${SYSCONFDIR}/zabbix/
share/examples/zabbix/zabbix_agent.conf

View File

@ -1,4 +1,6 @@
@comment $OpenBSD: PLIST-web,v 1.1.1.1 2009/04/22 15:03:52 jasper Exp $
@comment $OpenBSD: PLIST-web,v 1.2 2009/06/03 17:54:12 jasper Exp $
@sample conf/modules.sample/zabbix.conf
@sample conf/php5.sample/zabbix.ini
zabbix/
zabbix/acknow.php
zabbix/actionconf.php