Clean up this port:

* add missing dependency on php5-gd
* remove all hardcoded paths
* rework README.OpenBSD
* add empty zabbix.conf.php file that is writable by the www user so
that the configuration wizard can tweak this file
* protect configuration files, they may contain passwords
* fix configuration so that it works by default which is the purpose of
porting these kinds of apps

ok sthen@, ok jasper@ on a previous version of the diff
This commit is contained in:
ajacoutot 2009-07-12 19:51:51 +00:00
parent 7979f486cd
commit 29da65e8ea
9 changed files with 137 additions and 47 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.6 2009/06/11 16:38:17 sthen Exp $
# $OpenBSD: Makefile,v 1.7 2009/07/12 19:51:51 ajacoutot Exp $
COMMENT-main = network and application monitoring - agent
COMMENT-server = network and application monitoring - server
@ -6,11 +6,12 @@ COMMENT-web = network and application monitoring - web frontend
COMMENT-doc = network and application monitoring - non-free documentation
VERSION = 1.6.4
MAJOR = ${VERSION:R}
DISTNAME = zabbix-${VERSION}
PKGNAME-main = zabbix-agent-${VERSION}p3
PKGNAME-server = zabbix-server-${VERSION}p4
PKGNAME-doc = zabbix-doc-${VERSION}p0
PKGNAME-web = zabbix-web-${VERSION}p2
PKGNAME-main = zabbix-agent-${VERSION}p4
PKGNAME-server = zabbix-server-${VERSION}p5
PKGNAME-doc = zabbix-doc-${VERSION}p1
PKGNAME-web = zabbix-web-${VERSION}p4
CATEGORIES = net
HOMEPAGE = http://www.zabbix.com/
@ -33,7 +34,7 @@ MULTI_PACKAGES = -main -doc
PSEUDO_FLAVORS = no_server
FLAVORS = mysql pgsql
SUBST_VARS += PREFIX-web ZABBIX_WEB
SUBST_VARS += PREFIX-web ZABBIX_WEB MAJOR
WANTLIB = c kvm m
LIB_DEPENDS = lber,ldap::databases/openldap
@ -61,6 +62,7 @@ CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include" \
PREFIX-web = /var/www
LIB_DEPENDS-web =
RUN_DEPENDS-web = ::www/php5/extensions,-gd
WANTLIB-web =
ZABBIX_WEB = ${PREFIX-web}/htdocs/zabbix
@ -73,12 +75,12 @@ BACKEND = ${FLAVOR}
.if ${BACKEND} == "mysql"
MULTI_PACKAGES += -server -web
LIB_DEPENDS-server += mysqlclient::databases/mysql,-main
RUN_DEPENDS-web = ::www/php5/extensions,-mysql
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
RUN_DEPENDS-web + = ::www/php5/extensions,-pgsql
CONFIGURE_ARGS += --with-pgsql
.elif ${BACKEND} == "no_server"
CONFIGURE_ARGS += --disable-server \
@ -87,14 +89,16 @@ CONFIGURE_ARGS += --disable-server \
ERRORS += "Fatal: Conflicting flavors: ${FLAVOR}";
.endif
pre-configure:
${SUBST_CMD} ${WRKSRC}/misc/conf/zabbix_server.conf \
${WRKSRC}/misc/conf/zabbix_proxy.conf
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 \
${WRKBUILD}/README.OpenBSD
${INSTALL_DATA} ${WRKBUILD}/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
@ -120,8 +124,11 @@ post-install:
# Script to easy upgrading from previous major version
cd ${WRKSRC}/upgrades/ && tar -cf - dbpatches | \
tar -C ${PREFIX}/share/zabbix -xf -
MAJOR = ${VERSION:R}
SUBST_VARS = MAJOR
touch ${WRKINST}/${PREFIX-web}/zabbix/conf/zabbix.conf.php
chown www ${WRKINST}/${PREFIX-web}/zabbix/conf/zabbix.conf.php
chown ${SHAREOWN}:${SHAREGRP} \
${PREFIX}/share/doc/zabbix/README.OpenBSD \
${DESTDIR}${PREFIX-web}/conf/modules.sample/zabbix.conf \
${DESTDIR}${PREFIX-web}/conf/php5.sample/zabbix.ini
.include <bsd.port.mk>

View File

@ -1,7 +1,8 @@
$OpenBSD: README.OpenBSD,v 1.1 2009/06/03 17:54:12 jasper Exp $
$OpenBSD: README.OpenBSD,v 1.2 2009/07/12 19:51:51 ajacoutot Exp $
This document gives information relevant to using ZABBIX on OpenBSD.
The original documentation is available as a PDF file at ${HOMEPAGE}
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.
@ -22,17 +23,19 @@ 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.
Next, you ou have to adapt the configuration files under
${SYSCONFDIR}/zabbix/
if [ -x ${PREFIX}/bin/zabbix_server ]; then
echo -n ' zabbix'; ${PREFIX}/bin/zabbix_server
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, follow the same procedure, replacing zabbix_server
with zabbix_proxy.
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
@ -52,8 +55,8 @@ 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.
through the web interface at http://<hostname>/zabbix/setup.php.
(default user is 'admin' with password 'zabbix')
== MySQL ==
@ -77,14 +80,15 @@ 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;
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
${PREFIX}/share/examples/zabbix:
$ cd ${PREFIX}/share/zabbix/schema
$ cd ${TRUEPREFIX}/share/zabbix/schema
$ mysql -uzabbix -p[password] zabbix < mysql.sql
$ cd ../data
$ mysql -uzabbix -p[password] zabbix < data.sql ## N.B. slow!!
@ -104,7 +108,7 @@ And initialize the database:
$ psql -U zabbix
psql> create database zabbix;
psql> \q
$ cd ${PREFIX}/share/zabbix/schema
$ cd ${TRUEPREFIX}/share/zabbix/schema
$ cat postgresql.sql | psql -U zabbix zabbix
$ cd ../data
$ cat data.sql | psql -U zabbix zabbix

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-misc_conf_zabbix_agentd_conf,v 1.1 2009/07/12 19:51:51 ajacoutot Exp $
--- misc/conf/zabbix_agentd.conf.orig Thu Jul 2 09:48:17 2009
+++ misc/conf/zabbix_agentd.conf Thu Jul 2 10:41:09 2009
@@ -65,12 +65,12 @@ DebugLevel=3
# Name of PID file
-PidFile=/var/tmp/zabbix_agentd.pid
+PidFile=/var/run/zabbix/zabbix_agentd.pid
# Name of log file.
# If not set, syslog will be used
-LogFile=/tmp/zabbix_agentd.log
+#LogFile=/tmp/zabbix_agentd.log
# Maximum size of log file in MB. Set to 0 to disable automatic log rotation.
#LogFileSize=1

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.1 2009/04/23 15:38:11 jasper Exp $
--- misc/conf/zabbix_proxy.conf.orig Wed Apr 22 23:07:00 2009
+++ misc/conf/zabbix_proxy.conf Wed Apr 22 23:07:28 2009
@@ -123,11 +123,11 @@ Timeout=5
$OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.2 2009/07/12 19:51:51 ajacoutot Exp $
--- misc/conf/zabbix_proxy.conf.orig Fri Apr 3 16:44:06 2009
+++ misc/conf/zabbix_proxy.conf Thu Jul 2 10:00:27 2009
@@ -123,28 +123,28 @@ Timeout=5
#UnavailableDelay=60
# Name of PID file
@ -15,3 +15,39 @@ $OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.1 2009/04/23 15:38:11 jasper Exp
# Maximum size of log file in MB. Set to 0 to disable automatic log rotation.
#LogFileSize=1
# Location for custom alert scripts
-AlertScriptsPath=/home/zabbix/bin/
+AlertScriptsPath=${SYSCONFDIR}/zabbix/scripts/
# Location of external scripts
-#ExternalScripts=/etc/zabbix/externalscripts
+ExternalScripts=${SYSCONFDIR}/zabbix/externalscripts
# Location of 'fping. Default is /usr/sbin/fping
# Make sure that fping binary has root permissions and SUID flag set
-#FpingLocation=/usr/sbin/fping
+FpingLocation=${LOCALBASE}/sbin/fping
# Location of fping6. Default is /usr/sbin/fping6
# Make sure that fping binary has root permissions and SUID flag set
-#Fping6Location=/usr/sbin/fping6
+Fping6Location=${LOCALBASE}/sbin/fping6
# Temporary directory. Default is /tmp
#TmpDir=/tmp
@@ -163,7 +163,7 @@ DBName=proxy
# Database user
-DBUser=root
+DBUser=zabbix
# Database password
# Comment this line if no password used
@@ -172,4 +172,4 @@ DBUser=root
# Connect to MySQL using Unix socket?
-#DBSocket=/tmp/mysql.sock
+DBSocket=/var/www/var/run/mysql/mysql.sock

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.1 2009/04/23 15:38:11 jasper Exp $
--- misc/conf/zabbix_server.conf.orig Wed Apr 22 23:08:16 2009
+++ misc/conf/zabbix_server.conf Wed Apr 22 23:12:28 2009
$OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.2 2009/07/12 19:51:51 ajacoutot Exp $
--- misc/conf/zabbix_server.conf.orig Fri Apr 3 16:44:06 2009
+++ misc/conf/zabbix_server.conf Thu Jul 2 10:07:49 2009
@@ -99,29 +99,29 @@ Timeout=5
# Name of PID file
@ -22,17 +22,18 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.1 2009/04/23 15:38:11 jasper Ex
+AlertScriptsPath=${SYSCONFDIR}/zabbix/scripts/
# Location of external scripts
#ExternalScripts=/etc/zabbix/externalscripts
-#ExternalScripts=/etc/zabbix/externalscripts
+ExternalScripts=${SYSCONFDIR}/zabbix/externalscripts
# Location of fping. Default is /usr/sbin/fping
# Make sure that fping binary has root permissions and SUID flag set
-#FpingLocation=/usr/sbin/fping
+FpingLocation=${PREFIX}/sbin/fping
+FpingLocation=${LOCALBASE}/sbin/fping
# Location of fping6. Default is /usr/sbin/fping6
# Make sure that fping binary has root permissions and SUID flag set
-#Fping6Location=/usr/sbin/fping6
+Fping6Location=${PREFIX}/sbin/fping6
+Fping6Location=${LOCALBASE}/sbin/fping6
# Temporary directory. Default is /tmp
#TmpDir=/tmp
@ -50,4 +51,4 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.1 2009/04/23 15:38:11 jasper Ex
# Connect to MySQL using Unix socket?
-#DBSocket=/tmp/mysql.sock
+DBSocket=/var/run/mysql/mysql.sock
+DBSocket=/var/www/var/run/mysql/mysql.sock

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-misc_conf_zabbix_trapper_conf,v 1.1 2009/04/23 15:38:11 jasper Exp $
--- misc/conf/zabbix_trapper.conf.orig Wed Apr 22 23:13:12 2009
+++ misc/conf/zabbix_trapper.conf Wed Apr 22 23:13:20 2009
$OpenBSD: patch-misc_conf_zabbix_trapper_conf,v 1.2 2009/07/12 19:51:51 ajacoutot Exp $
--- misc/conf/zabbix_trapper.conf.orig Fri Apr 3 16:44:06 2009
+++ misc/conf/zabbix_trapper.conf Thu Jul 2 10:00:43 2009
@@ -19,7 +19,7 @@ Timeout=3
# Name of log file
# If not set, syslog will be used
@ -10,3 +10,18 @@ $OpenBSD: patch-misc_conf_zabbix_trapper_conf,v 1.1 2009/04/23 15:38:11 jasper E
# Database host name
# Default is localhost
@@ -32,7 +32,7 @@ DBName=zabbix
# Database user
-DBUser=root
+DBUser=zabbix
# Database password
# Comment this line if no password used
@@ -41,4 +41,4 @@ DBUser=root
# Connect to MySQL usig Unix socket?
-#DBSocket=/tmp/mysql.sock
+DBSocket=/var/www/var/run/mysql/mysql.sock

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.3 2009/06/03 17:54:12 jasper Exp $
@comment $OpenBSD: PLIST-main,v 1.4 2009/07/12 19:51:51 ajacoutot Exp $
@newgroup _zabbix:623
@newuser _zabbix:623:_zabbix:daemon:zabbix user:/nonexistent:/sbin/nologin
@bin sbin/zabbix_agent
@ -9,7 +9,11 @@ share/doc/zabbix/
share/doc/zabbix/README.OpenBSD
share/examples/zabbix/
@sample ${SYSCONFDIR}/zabbix/
@mode 640
@group _zabbix
share/examples/zabbix/zabbix_agent.conf
@sample ${SYSCONFDIR}/zabbix/zabbix_agent.conf
share/examples/zabbix/zabbix_agentd.conf
@sample ${SYSCONFDIR}/zabbix/zabbix_agentd.conf
@mode
@group

View File

@ -1,14 +1,18 @@
@comment $OpenBSD: PLIST-server,v 1.3 2009/06/11 16:38:17 sthen Exp $
@comment $OpenBSD: PLIST-server,v 1.4 2009/07/12 19:51:51 ajacoutot Exp $
@bin sbin/zabbix_proxy
@bin sbin/zabbix_server
@sample ${SYSCONFDIR}/zabbix/
share/examples/zabbix/
@mode 640
@group _zabbix
share/examples/zabbix/zabbix_proxy.conf
@sample ${SYSCONFDIR}/zabbix/zabbix_proxy.conf
share/examples/zabbix/zabbix_server.conf
@sample ${SYSCONFDIR}/zabbix/zabbix_server.conf
share/examples/zabbix/zabbix_trapper.conf
@sample ${SYSCONFDIR}/zabbix/zabbix_trapper.conf
@mode
@group
share/zabbix/
share/zabbix/data/
share/zabbix/data/data.sql

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-web,v 1.3 2009/06/11 16:38:17 sthen Exp $
@comment $OpenBSD: PLIST-web,v 1.4 2009/07/12 19:51:51 ajacoutot Exp $
conf/modules.sample/zabbix.conf
@comment conf/php5.sample/
conf/php5.sample/zabbix.ini
@ -26,6 +26,7 @@ zabbix/charts.php
zabbix/conf/
zabbix/conf/COPYING
zabbix/conf/maintenance.inc.php
zabbix/conf/zabbix.conf.php
zabbix/config.php
zabbix/create/
zabbix/create/data.sql