Rewrite / fix several portions of the READMEs.

Move README-main to README-server.
Create a default /var/db/zabbix/ directory for sqlite3 usage.
Add rc scripts for zabbix_agentd, zabbix_proxy and zabbix_server.
This commit is contained in:
ajacoutot 2010-11-22 15:39:20 +00:00
parent fb2092618b
commit a7b6686681
9 changed files with 220 additions and 161 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.36 2010/11/19 22:31:39 espie Exp $
# $OpenBSD: Makefile,v 1.37 2010/11/22 15:39:20 ajacoutot Exp $
COMMENT-main = network and application monitoring - agent
COMMENT-server = network and application monitoring - server
@ -13,9 +13,9 @@ FULLPKGNAME-web = zabbix-web-${VERSION}
FULLPKGPATH-web = net/zabbix,-web
CATEGORIES = net
REVISION-main = 5
REVISION-server = 2
REVISION-web = 1
REVISION-main = 6
REVISION-server = 3
REVISION-web = 2
MAJV = ${VERSION:C/^([0-9]+\.[0-9]+).*/\1/}

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.9 2010/11/06 09:01:07 ajacoutot Exp $
@comment $OpenBSD: PLIST-main,v 1.10 2010/11/22 15:39:21 ajacoutot Exp $
@pkgpath net/zabbix,-main,mysql
@pkgpath net/zabbix,-main,pgsql
@pkgpath net/zabbix,-doc,mysql
@ -13,7 +13,6 @@
@man man/man8/zabbix_agentd.8
@bin sbin/zabbix_agent
@bin sbin/zabbix_agentd
share/doc/pkg-readmes/${FULLPKGNAME}
share/examples/zabbix/
@sample ${SYSCONFDIR}/zabbix/
share/examples/zabbix/zabbix_agent.conf
@ -27,3 +26,6 @@ share/examples/zabbix/zabbix_agentd.conf
@group _zabbix
@sample ${SYSCONFDIR}/zabbix/zabbix_agentd.conf
@comment share/examples/zabbix/zabbix_agentd.win.conf
@mode
@group
@rcscript ${RCDIR}/zabbix_agentd

View File

@ -1,9 +1,11 @@
@comment $OpenBSD: PLIST-server,v 1.9 2010/11/08 06:27:32 ajacoutot Exp $
@comment $OpenBSD: PLIST-server,v 1.10 2010/11/22 15:39:21 ajacoutot Exp $
@conflict zabbix-agent-<=1.8.3p5
@man man/man8/zabbix_proxy.8
@man man/man8/zabbix_server.8
@sample ${SYSCONFDIR}/zabbix/
@bin sbin/zabbix_proxy
@bin sbin/zabbix_server
share/doc/pkg-readmes/${FULLPKGNAME}
share/examples/zabbix/zabbix_proxy.conf
@mode 640
@group _zabbix
@ -65,3 +67,12 @@ share/zabbix/schema/mysql.sql
share/zabbix/schema/oracle.sql
share/zabbix/schema/postgresql.sql
share/zabbix/schema/sqlite.sql
@mode 750
@owner _zabbix
@group _zabbix
@sample /var/db/zabbix/
@mode
@owner
@group
@rcscript ${RCDIR}/zabbix_proxy
@rcscript ${RCDIR}/zabbix_server

View File

@ -1,153 +0,0 @@
$OpenBSD: README-main,v 1.1 2010/11/06 09:01:07 ajacoutot Exp $
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.
A manual is available at:
http://www.zabbix.com/documentation/${MAJV}/complete
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/
(make sure your webserver can resolve hostnames; otherwise use IP
addresses in the configuration files).
To have the ZABBIX server start at boot time, insert the following into
/etc/rc.local(8):
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 Zabbix Server or Proxy might fail due to lack of shared memory
("Can't allocate shared memory..." errors), in which case you should set
kern.shminfo.shmall to 32768 -- see sysctl(8) and sysctl.conf(5).
On a busy server, it may be advisable to put the _zabbix user and
processes in their own login(1) class with tuned resources, such as more
open file descriptors etc.
e.g. add this to the login.conf(5) file:
zabbix:\
:openfiles-cur=1024:\
:openfiles-max=2048:\
:tc=daemon:
Then change the rc.local(8) zabbix_server start line with the following:
echo -n ' zabbix_server'; su -c zabbix root -c '/usr/local/sbin/zabbix_server'
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
The following steps are not required for setting up a Zabbix Proxy.
$ 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:
$ cd ${TRUEPREFIX}/share/zabbix/schema
$ cat postgresql.sql | psql -U zabbix zabbix
The following steps are not required for setting up a Zabbix Proxy.
$ cd ../data
$ cat data.sql | psql -U zabbix zabbix
$ cat images_pgsql.sql | psql -U zabbix zabbix
== SQLite3 ==
$ mkdir /var/db/zabbix
$ chown _zabbix /var/db/zabbix
The following steps are optional as Zabbix will automatically create
and initialize the database if it does not exist.
$ cd ${TRUEPREFIX}/share/zabbix/schema
$ cat sqlite.sql | sudo -u _zabbix sqlite3 /var/db/zabbix/zabbix.db
The following steps are not required for setting up a Zabbix Proxy.
$ cd ../data
$ cat data.sql | sudo -u _zabbix sqlite3 /var/db/zabbix/zabbix.db
$ cat images_sqlite3.sql | sudo -u _zabbix sqlite3 /var/db/zabbix/zabbix.db

View File

@ -0,0 +1,117 @@
$OpenBSD: README-server,v 1.1 2010/11/22 15:39:21 ajacoutot Exp $
Using Zabbix on OpenBSD
=======================
The original documentation is available as a PDF file at
${HOMEPAGE}
A manual is available at:
http://www.zabbix.com/documentation/${MAJV}/complete
On OpenBSD, Zabbix is packaged in three 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, pgsql or sqlite3).
- the web interface to run with the server (in the zabbix-web package).
Before doing anything, you have to adapt the configuration files under
${SYSCONFDIR}/zabbix/
(make sure your webserver can resolve hostnames; otherwise use IP
addresses in the configuration files).
On OpenBSD, the default shared memory value is too low for the Zabbix
Server and Proxy to work properly. You should set kern.shminfo.shmall
according to your needs ("32768" is a good value for starter) -- see
sysctl(8) and sysctl.conf(5).
On a busy server, it may be advisable to put the _zabbix user and
processes into their own login(1) class with tuned resources, such as
more open file descriptors etc.
e.g. add the following lines to login.conf(5):
zabbix:\
:openfiles-cur=1024:\
:openfiles-max=2048:\
:tc=daemon
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
The following steps are not required for setting up a Zabbix Proxy.
$ 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:
$ cd ${TRUEPREFIX}/share/zabbix/schema
$ cat postgresql.sql | psql -U zabbix zabbix
The following steps are not required for setting up a Zabbix Proxy.
$ cd ../data
$ cat data.sql | psql -U zabbix zabbix
$ cat images_pgsql.sql | psql -U zabbix zabbix
SQLite3
-------
The following steps are optional on a Zabbix Proxy, the database will be
automatically created and initialized if it does not exist.
$ cd ${TRUEPREFIX}/share/zabbix/schema
$ cat sqlite.sql | sudo -u _zabbix sqlite3 /var/db/zabbix/zabbix.db
The following steps are not required for setting up a Zabbix Proxy.
$ cd ../data
$ cat data.sql | sudo -u _zabbix sqlite3 /var/db/zabbix/zabbix.db
$ cat images_sqlite3.sql | sudo -u _zabbix sqlite3 /var/db/zabbix/zabbix.db

View File

@ -1,4 +1,4 @@
$OpenBSD: README-web,v 1.1 2010/11/06 09:01:07 ajacoutot Exp $
$OpenBSD: README-web,v 1.2 2010/11/22 15:39:21 ajacoutot Exp $
The Zabbix web frontend has been installed into
${PREFIX-web}/zabbix
@ -10,3 +10,19 @@ You should point this to the DocumentRoot of your web-server:
zabbix-web frontend can use a PostgreSQL, MySQL or SQLite3 database.
Install the php5-pgsql, php5-mysql or php5-pdo_sqlite package according
to the one you wish to use.
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.

View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# $OpenBSD: zabbix_agentd.rc,v 1.1 2010/11/22 15:39:21 ajacoutot Exp $
. /etc/rc.d/rc.subr
daemon="${TRUEPREFIX}/sbin/zabbix_agentd"
pexp="zabbix_agentd: main process"
rc_pre() {
install -d -o _zabbix -g _zabbix /var/run/zabbix
}
rc_reload() {
rc_err "$0: reload is not supported"
}
rc_cmd $1

View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# $OpenBSD: zabbix_proxy.rc,v 1.1 2010/11/22 15:39:21 ajacoutot Exp $
. /etc/rc.d/rc.subr
daemon="${TRUEPREFIX}/sbin/zabbix_proxy"
pexp="zabbix_proxy: heartbeat sender"
rc_pre() {
install -d -o _zabbix -g _zabbix /var/run/zabbix
}
rc_start() {
type rc_pre >/dev/null && rc_pre
getcap -f /etc/login.conf zabbix 1>/dev/null 2>&1 && _class=zabbix
su -c ${_class:-daemon} -m root -c "${daemon} ${daemon_flags}" >/dev/null
}
rc_reload() {
rc_err "$0: reload is not supported"
}
rc_cmd $1

View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# $OpenBSD: zabbix_server.rc,v 1.1 2010/11/22 15:39:21 ajacoutot Exp $
. /etc/rc.d/rc.subr
daemon="${TRUEPREFIX}/sbin/zabbix_server"
pexp="zabbix_server: main process"
rc_pre() {
install -d -o _zabbix -g _zabbix /var/run/zabbix
}
rc_start() {
type rc_pre >/dev/null && rc_pre
getcap -f /etc/login.conf zabbix 1>/dev/null 2>&1 && _class=zabbix
su -c ${_class:-daemon} -m root -c "${daemon} ${daemon_flags}" >/dev/null
}
rc_reload() {
rc_err "$0: reload is not supported"
}
rc_cmd $1