- attach icinga-web to build

icinga-core:
- bump REVISION for -main, -cgi and -ido
- remove CFGDIR, MAKE_FLAGS from Makefile which are relics
- replace /var/www with ${PREFIX-cgi}
- add instructions for icinga-web to README
- choose mysql by default

icinga-web:
- bump REVISION
- remove README, all instructions are in the icinga-core README
- remove comments about w.i.p
- choose mysql by default
- tell configure where to find icinga binary, icinga.cfg and the
  icinga objects dir
- add icinga, icinga-idoutils and bash to RUN_DEPENDS
- patch shells scripts to use the correct path for bash
- patch databases.xml.in to have both DBs enabled by default

with help and ok from sthen aja
This commit is contained in:
rpe 2012-10-12 17:59:24 +00:00
parent 13a086e13e
commit 0ff516f6e8
7 changed files with 161 additions and 88 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/03/28 14:06:06 sthen Exp $
# $OpenBSD: Makefile,v 1.2 2012/10/12 17:59:24 rpe Exp $
SUBDIR =
SUBDIR += core
# SUBDIR += web
SUBDIR += web
.include <bsd.port.subdir.mk>

View File

@ -1,6 +1,8 @@
# $OpenBSD: Makefile,v 1.32 2012/10/01 23:05:01 sthen Exp $
# $OpenBSD: Makefile,v 1.33 2012/10/12 17:59:25 rpe Exp $
REVISION-main = 1
REVISION-main = 2
REVISION-cgi = 0
REVISION-ido = 0
COMMENT-main = network monitoring system (improved fork of Nagios)
COMMENT-cgi = cgi scripts for Icinga (classic Nagios-style UI)
@ -26,7 +28,7 @@ LIB_DEPENDS-main = devel/libtool,-ltdl
WANTLIB-ido = ${WANTLIB} dbi
LIB_DEPENDS-ido = databases/libdbi
RUN_DEPENDS-ido = ${BASE_PKGPATH},-main \
libdbi-drivers-mysql-*|libdbi-drivers-pgsql-*:databases/libdbi-drivers,-pgsql
libdbi-drivers-mysql-*|libdbi-drivers-pgsql-*:databases/libdbi-drivers,-main
MODULES = lang/php
@ -44,14 +46,14 @@ SYSCONFDIR = ${BASESYSCONFDIR}/icinga
CONFIGURE_STYLE = gnu
CONFIGURE_ARGS += \
--datarootdir=/var/www/icinga-cgi \
--datarootdir=${PREFIX-cgi}/icinga-cgi \
--libexecdir=${PREFIX}/libexec/nagios \
--sbindir=/var/www/cgi-bin/icinga \
--sbindir=${PREFIX-cgi}/cgi-bin/icinga \
--with-command-group=www \
--with-cgiurl=/cgi-bin/icinga \
--with-checkresult-dir=/var/spool/icinga \
--with-htmurl=/icinga \
--with-httpd-conf=/var/www/conf/modules.sample \
--with-httpd-conf=${PREFIX-cgi}/conf/modules.sample \
--with-icinga-group=_icinga \
--with-icinga-user=_icinga \
--with-lockfile=/var/run/icinga/icinga.pid \
@ -65,8 +67,6 @@ CFLAGS += -fPIC \
-I${LOCALBASE}/include \
-L${X11BASE}/lib -L${LOCALBASE}/lib
CFGDIR = ${SYSCONFDIR}/icinga
MAKE_FLAGS = CFGDIR=${CFGDIR} SYSCONFDIR=${CFGDIR}
INSTALL_TARGET = install-unstripped install-idoutils \
install-config install-webconf

View File

@ -1,4 +1,4 @@
$OpenBSD: README-main,v 1.8 2012/10/01 23:05:01 sthen Exp $
$OpenBSD: README-main,v 1.9 2012/10/12 17:59:25 rpe Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
@ -9,17 +9,27 @@ Getting Started
The main documentation for Icinga is provided in HTML format as part of
the icinga-cgi package, see /var/www/icinga-cgi/docs/en/index.html
or at http://docs.icinga.org/latest/en/.
The included sample configuration carries out some simple checks
on the local machine; these should work as-is.
You may check your configuration file format before starting Icinga:
/usr/local/bin/icinga -v ${SYSCONFDIR}/icinga.cfg
$ sudo -u _icinga ${TRUEPREFIX}/bin/icinga -v ${SYSCONFDIR}/icinga.cfg
This will parse all configuration files and warn about any problems
which have been identified.
To enable automatic startup on boot for icinga, add it to pkg_scripts
in ${SYSCONFDIR}/rc.conf.local, for example:
pkg_scripts="${pkg_scripts} icinga"
To start icinga, reboot or start it manually:
$ sudo /etc/rc.d/icinga start
Upgrading from a previous version
=================================
@ -35,43 +45,105 @@ ${SYSCONFDIR}/icinga/icinga.cfg.
Chroot Considerations
=====================
If using OpenBSD's default chroot environment for httpd, some files
will need to be moved inside the jail and symbolic links created:
If you're using OpenBSD's default chroot environment for httpd with
the icinga-cgi package, some files will need to be moved inside the
jail and symbolic links created.
mkdir -p /var/www/etc /var/www/var/log
mv ${SYSCONFDIR}/icinga /var/www/etc/
ln -s /var/www/etc/icinga ${SYSCONFDIR}
mv /var/icinga /var/www/var/
ln -s /var/www/var/icinga /var
mv /var/log/icinga /var/www/var/log/
ln -s /var/www/var/log/icinga /var/log
mkdir -p ${PREFIX-cgi}/etc ${PREFIX-cgi}/var/log
mv ${SYSCONFDIR}/icinga ${PREFIX-cgi}/etc/
ln -s ${PREFIX-cgi}/etc/icinga ${SYSCONFDIR}
mv /var/icinga ${PREFIX-cgi}/var/
ln -s ${PREFIX-cgi}/var/icinga /var
mv /var/log/icinga ${PREFIX-cgi}/var/log/
ln -s ${PREFIX-cgi}/var/log/icinga /var/log
Web User-Interfaces
===================
Two web-based user interfaces are available for Icinga:
- icinga-cgi: the classic (but improved) Nagios-style interface
- icinga-web: new API-based interface
1) icinga-cgi: the classic (but improved) Nagios-style interface
At the time of writing, porting and packaging of icinga-web is
a work-in-progress. To enable icinga-cgi, link the provided httpd.conf
snippet:
To enable icinga-cgi, link the provided httpd.conf snippet:
ln -s ../modules.sample/icinga-cgi.conf /var/www/conf/modules
$ sudo ln -s /var/www/conf/modules.sample/icinga-cgi.conf \
/var/www/conf/modules
You may wish to modify this file. By default it uses HTTP basic
authentication; you can create the password file as follows:
You may wish to modify this file. By default it uses HTTP basic
authentication; you can create the password file as follows:
touch ${SYSCONFDIR}/icinga/htpasswd.users
htpasswd ${SYSCONFDIR}/icinga/htpasswd.users <username>
$ sudo touch ${SYSCONFDIR}/icinga/htpasswd.users
$ sudo htpasswd ${SYSCONFDIR}/icinga/htpasswd.users <username>
When done, restart the web server:
When done, restart the web server:
/etc/rc.d/httpd restart
$ sudo /rc.d/httpd restart
You should then be able to access the web interface at
http://localhost/icinga/
2) icinga-web: new API-based interface
2.1) Setup the icinga database. For details see:
${TRUEPREFIX}/share/examples/icinga/db/README
2.2) Enable the ido2db daemon. Add it to the pkg_scripts line
in ${SYSCONFDIR}/rc.conf.local before icinga, for example:
pkg_scripts="${pkg_scripts} ido2db icinga"
Afterwards, you can start it by rebooting, or manually:
$ sudo /etc/rc.d/ido2db start
2.3) Enable the broker_module idomod.so in /etc/icinga/icinga.cfg
and restart icinga:
$ sudo /etc/rc.d/icinga restart
Now you should see in the icinga logfile, that icinga is storing
information in the db.
2.4) Setup the icinga_web database (change the password!):
mysql -u root -p <<EOF
CREATE DATABASE icinga_web;
GRANT USAGE ON *.* TO 'icinga_web'@'localhost'
IDENTIFIED BY 'icinga_web_password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX
ON icinga_web.* TO 'icinga_web'@'localhost';
FLUSH PRIVILEGES;
\u icinga_web
\. /var/www/icinga-web/etc/schema/mysql.sql
EOF
2.5) Change the db settings accordingly for both icinga and for
icinga_web in /var/www/icinga-web/etc/conf.d/databases.xml.
2.6) To enable icinga-web, link the provided httpd.conf snippet:
$ sudo ln -s /var/www/conf/modules.sample/icinga-web.conf \
/var/www/conf/modules
2.7) Currently, icinga-web is not tested to work with the httpd
chroot environment. So before you start httpd, ensure that you've
added "-u" to httpd_flags in /etc/rc.d/httpd.
$ sudo /etc/rc.d/httpd start
You should then be able to access the web interface at
http://localhost/icinga-web/
using user 'root' and 'password' as password. Change the default
password in the preferences as soon as possible!.
If you want to use the classic interface from within icinga-web
you have to install the icinga-cgi package. The reporting component
of icinga-web depends on external software which is not installed
by default.
You should then be able to access the web interface at
http://localhost/icinga/
Moving from Nagios
==================

View File

@ -1,16 +1,18 @@
# $OpenBSD: Makefile,v 1.11 2012/05/17 11:06:33 sthen Exp $
# Work in progress. Not yet linked to the build.
# $OpenBSD: Makefile,v 1.12 2012/10/12 17:59:25 rpe Exp $
COMMENT = web UI for icinga
DISTNAME = icinga-web-$V
REVISION = 0
MODULES= lang/php
RUN_DEPENDS = www/pear \
lang/php/${MODPHP_VERSION},-ldap \
lang/php/${MODPHP_VERSION},-xsl \
php-pdo_mysql-${MODPHP_VSPEC}|php-pdo_pgsql-${MODPHP_VSPEC}:lang/php/${MODPHP_VERSION},-pdo_mysql
php-pdo_mysql-${MODPHP_VSPEC}|php-pdo_pgsql-${MODPHP_VSPEC}:lang/php/${MODPHP_VERSION},-pdo_mysql \
net/icinga/core \
net/icinga/core,-ido \
shells/bash
# Optional php extensions: gd soap xmlrpc
# memcache
@ -19,7 +21,7 @@ LOCALSTATEDIR = ${BASELOCALSTATEDIR}/icinga
CONFIGURE_STYLE = gnu
CONFIGURE_ENV += PHP="${MODPHP_BIN}"
CONFIGURE_ARGS += \
--datarootdir=/var/www \
--datarootdir=${PREFIX} \
--sbindir=/var/www/cgi-bin/icinga \
--with-web-apache-path=${PREFIX}/etc \
--with-api-cmd-file=/var/icinga/rw/icinga.cmd \
@ -27,7 +29,10 @@ CONFIGURE_ARGS += \
--with-web-group=www \
--with-bin-user=${SHAREOWN} \
--with-bin-group=${SHAREGRP} \
--with-db-socket=/var/run/mysql/mysql.sock
--with-db-socket=/var/run/mysql/mysql.sock \
--with-icinga-bin=${LOCALBASE}/bin/icinga \
--with-icinga-cfg=${BASESYSCONFDIR}/icinga/icinga.cfg \
--with-icinga-objects-dir=${BASESYSCONFDIR}/icinga/objects
# override default ("localhost") to allow tcp connections; makes mysql easier
CONFIGURE_ARGS += \
--with-api-host=127.0.0.1 \
@ -40,14 +45,16 @@ INSTALL_TARGET = install install-apache-config
PREFIX = /var/www/icinga-web
post-configure:
@find ${WRKSRC}/bin -name '*.sh' -print0 | xargs -0r \
perl -pi -e 's,^#!/bin/bash,#!${LOCALBASE}/bin/bash,g'
pre-install:
${INSTALL_DATA_DIR} ${WRKINST}/var/www/conf/modules.sample
post-install:
find ${WRKINST} -name '*.orig' -print0 | xargs -0r rm
cd ${PREFIX}; \
find ${PREFIX} -name '*.site.xml' -exec mv {} {}.dist \;
mv ${PREFIX}/app/config/databases.xml{,.dist}
${INSTALL_DATA_DIR} ${PREFIX}/etc/schema/updates
cd ${WRKSRC}/etc/schema; \
${INSTALL_DATA} *sql ${PREFIX}/etc/schema; \

View File

@ -0,0 +1,37 @@
$OpenBSD: patch-etc_conf_d_databases_xml_in,v 1.1 2012/10/12 17:59:25 rpe Exp $
--- etc/conf.d/databases.xml.in.orig Fri Oct 12 18:57:11 2012
+++ etc/conf.d/databases.xml.in Fri Oct 12 18:57:29 2012
@@ -16,7 +16,7 @@
<!--
Overwrite the icinga-web database (where users, roles, views, etc are stored
-->
- <!--
+
<db:database name="icinga_web" class="AppKitDoctrineDatabase">
<ae:parameter name="dsn">@db_type@://@db_user@:@db_pass@@@db_host@:@db_port@/@db_name@</ae:parameter>
@@ -39,14 +39,14 @@
</ae:parameter>
</db:database>
- -->
+
<!--
Overwrite the default database conneciton for icinga data retrieval
Make sure to use IcingaDoctrineDatabase, otherwise the use_retained parameter will be ignored
EXAMPLE (oracle needs icingaOracle as the db driver)
-->
- <!--
+
<db:database xmlns="http://agavi.org/agavi/config/parts/databases/1.0" name="icinga" class="IcingaDoctrineDatabase">
<ae:parameter name="dsn">@api_subtype@://@api_db_user@:@api_db_pass@@@api_host@:@api_port@/@api_db_name@</ae:parameter>
<ae:parameter name="prefix">@api_db_prefix@</ae:parameter>
@@ -66,6 +66,6 @@
</db:database>
- -->
+
</databases>

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.7 2012/09/30 18:09:50 sthen Exp $
@comment $OpenBSD: PLIST,v 1.8 2012/10/12 17:59:25 rpe Exp $
@conflict icinga-api-*
@pkgpath net/icinga/core,-api
app/
@ -16,8 +16,7 @@ app/config/compile.xml
app/config/config_handlers.xml
app/config/cronks.xml
app/config/css.xml
app/config/databases.xml.dist
@sample app/config/databases.xml
app/config/databases.xml
app/config/factories.xml
app/config/global_filters.xml
app/config/icinga.xml
@ -7880,5 +7879,3 @@ pub/styles/icinga-icons.css
pub/styles/icinga.css
pub/styles/icinga.site.css
pub/styles/statusmap.css
@cwd ${LOCALBASE}/share/doc/pkg-readmes
${FULLPKGNAME}

View File

@ -1,40 +0,0 @@
$OpenBSD: README,v 1.3 2012/05/17 11:06:33 sthen Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------
Connect to the database as an administrative user, create the
icinga_web user and database, grant privileges and import the default
schema.
Example for MySQL:
$ myqsl -u root -p
[...]
SQL> CREATE DATABASE icinga_web;
SQL> GRANT USAGE ON *.* TO 'icinga_web'@'localhost' IDENTIFIED BY 'icinga_web_password';
SQL> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON icinga_web.* TO 'icinga_web'@'localhost';
SQL> FLUSH PRIVILEGES;
SQL> \u icinga_web;
SQL> \. ${PREFIX}/etc/schema/mysql.sql
${PREFIX}/app/config/databases.xml
${PREFIX}/etc/conf.d/databases.xml ?!?!
Change the credentials for your database connection
N.B. app/config/databases.xml entries for icinga_web *and* icinga db's
....???.....
${PREFIX}/app/modules/Web/config/module.xml
Go to the appkit.factories section and change the path and the
credentials for the icinga-api
default
User: root
Pass: password