From 0ff516f6e80d24883e72a8af3c91806e0833a0d8 Mon Sep 17 00:00:00 2001 From: rpe Date: Fri, 12 Oct 2012 17:59:24 +0000 Subject: [PATCH] icinga: - 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 --- net/icinga/Makefile | 4 +- net/icinga/core/Makefile | 16 +-- net/icinga/core/pkg/README-main | 122 ++++++++++++++---- net/icinga/web/Makefile | 23 ++-- .../patches/patch-etc_conf_d_databases_xml_in | 37 ++++++ net/icinga/web/pkg/PLIST | 7 +- net/icinga/web/pkg/README | 40 ------ 7 files changed, 161 insertions(+), 88 deletions(-) create mode 100644 net/icinga/web/patches/patch-etc_conf_d_databases_xml_in delete mode 100644 net/icinga/web/pkg/README diff --git a/net/icinga/Makefile b/net/icinga/Makefile index 690a6005be6..2abdbb1dafd 100644 --- a/net/icinga/Makefile +++ b/net/icinga/Makefile @@ -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 diff --git a/net/icinga/core/Makefile b/net/icinga/core/Makefile index 4e4fcb87178..089058f3ad4 100644 --- a/net/icinga/core/Makefile +++ b/net/icinga/core/Makefile @@ -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 diff --git a/net/icinga/core/pkg/README-main b/net/icinga/core/pkg/README-main index 34e1e84225c..1c620ab24a0 100644 --- a/net/icinga/core/pkg/README-main +++ b/net/icinga/core/pkg/README-main @@ -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 + $ sudo touch ${SYSCONFDIR}/icinga/htpasswd.users + $ sudo htpasswd ${SYSCONFDIR}/icinga/htpasswd.users -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 < +- + ++ + +- ++ + + diff --git a/net/icinga/web/pkg/PLIST b/net/icinga/web/pkg/PLIST index fbea2781ca8..27b75845c83 100644 --- a/net/icinga/web/pkg/PLIST +++ b/net/icinga/web/pkg/PLIST @@ -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} diff --git a/net/icinga/web/pkg/README b/net/icinga/web/pkg/README deleted file mode 100644 index 93beb82cbc1..00000000000 --- a/net/icinga/web/pkg/README +++ /dev/null @@ -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 - - - -