On Friday, May 20, 2016 22:20 CEST, Stuart Henderson <[email protected]> 
wrote:

> On 2016/05/20 21:25, Sebastian Reitenbach wrote:
> >
> > On Friday, May 20, 2016 20:10 CEST, Stuart Henderson <[email protected]> 
> > wrote:
> >
> > > On 2016/05/20 19:59, Sebastian Reitenbach wrote:
> > > > Hi,
> > > >
> > > > I've finally got pnp4nagios running for me with icinga2, and now would
> > > > like to get this icinga2 flavor up and running ;)
> > > >
> > > > The icinga2 is only touching the RUN_DEPENDS, and the location
> > > > where the default perfdata dir located is.
> > > >
> > > > Alternatively, instead of a FLAVOR, maybe the RUN_DEPENDS
> > > > to icinga, and icingaweb could just be dropped, and the admin
> > > > is going to install/use whatever he prefers?
> > >
> > > Yep, a flavour to just change RUN_DEPENDS is a bit pointless.
> > > So if the perfdata path is just for the default setting and it
> > > can be overridden in config, it would be better to just add a
> > > note to the README explaining what to do.
> > >
> > > Also I think that there's no advantage to having a separate
> > > README-cgi and README-main for this port, it would probably be
> > > more sensible to roll them into a single README-main file.
> >
> > Alright, removed the RUN_DEPENDS, and dropped the FLAVOR.
> > I did not merged the README into a single file. I think the separation
> > is clearer, one takes care about configuration of the daemon, and
> > connection to the monitoring backend, the other file of the connection
> > to the frontend.
> > Does that make sense?
>
> It doesn't really make sense to me. Why would you need to look in
> two different pkg-readme files to configure one piece of software?
> Especially now you duplicated information between the two files.
> I think the only reason for the separate packages is because it's
> annoying to handle PLIST when you have files under two different
> prefixes.
>

I kind of was under the impression that it is possible to run the -cgi
SUBPACKAGE on a different node than the -main SUBPACKAGE.
However, looking at it again, I noticed (likely again ;)) that the -cgi
SUBPACKAGE has a dependency to the -main SUBPACKAGE.

So I tried to rework everything into the -main README.
While there, I tried to reword things a bit, hope that did not went
into the wrong direction ;) So how about this then?

cheers,
Sebastian

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/pnp4nagios/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile    18 May 2016 17:34:00 -0000      1.4
+++ Makefile    22 May 2016 20:42:29 -0000
@@ -7,8 +7,8 @@
 DISTNAME =     pnp4nagios-${V}
 PKGNAME-main = ${DISTNAME}
 PKGNAME-cgi =  pnp4nagios-cgi-${V}
-REVISION-main =        1
-REVISION-cgi =         0
+REVISION-main =        2
+REVISION-cgi =         1

 CATEGORIES =   www

@@ -25,10 +25,8 @@

 MODULES =              lang/php
 BUILD_DEPENDS =                net/rrdtool
-RUN_DEPENDS-main =     net/icinga/core \
-                       net/rrdtool
+RUN_DEPENDS-main =     net/rrdtool
 RUN_DEPENDS-cgi =      lang/php/${MODPHP_VERSION},-gd \
-                       net/icinga/web \
                        www/pnp4nagios,-main

 FAKE_FLAGS =           INSTALL_OPTS="-o root -g bin" \
Index: pkg/PLIST-cgi
===================================================================
RCS file: /cvs/ports/www/pnp4nagios/pkg/PLIST-cgi,v
retrieving revision 1.2
diff -u -r1.2 PLIST-cgi
--- pkg/PLIST-cgi       17 May 2016 07:13:42 -0000      1.2
+++ pkg/PLIST-cgi       22 May 2016 20:42:29 -0000
@@ -502,5 +502,3 @@
 pnp4nagios/templates.special/advanced_loop.php-sample
 pnp4nagios/templates.special/loop.php-sample
 pnp4nagios/templates.special/static.php-sample
-@cwd ${LOCALBASE}/share/doc/pkg-readmes
-${FULLPKGNAME}
Index: pkg/README-cgi
===================================================================
RCS file: pkg/README-cgi
diff -N pkg/README-cgi
--- pkg/README-cgi      26 Apr 2016 10:12:29 -0000      1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-$OpenBSD: README-cgi,v 1.1.1.1 2016/04/26 10:12:29 kirby Exp $
-
-+-----------------------------------------------------------------------
-| Running ${FULLPKGNAME} on OpenBSD
-+-----------------------------------------------------------------------
-
-Apache2
--------
-Apache2 configuration for PNP4Nagios is stored under:
-    ${VARBASE}/www/conf/modules.sample/pnp4nagios.conf
-
-It needs to be enabled by running the following command:
-# ln -s ../modules.sample/pnp4nagios.conf ${VARBASE}/www/conf/modules
-# rcctl restart apache2
-
-
-Icinga-web
-----------
-To integrate PNP4Nagios into the Icinga Web frontend you will need to
-install templates extensions which comes with icinga-web package:
-% cd ${VARBASE}/www/icinga-web/app/modules/Cronks/data/xml/extensions
-# ln -s pnp-host-extension.xml.dist pnp-host-extension.xml
-# ln -s pnp-service-extension.xml.dist pnp-service-extension.xml
Index: pkg/README-main
===================================================================
RCS file: /cvs/ports/www/pnp4nagios/pkg/README-main,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 README-main
--- pkg/README-main     26 Apr 2016 10:12:29 -0000      1.1.1.1
+++ pkg/README-main     22 May 2016 20:42:29 -0000
@@ -1,10 +1,119 @@
 $OpenBSD: README-main,v 1.1.1.1 2016/04/26 10:12:29 kirby Exp $

 +-----------------------------------------------------------------------
-| Running ${FULLPKGNAME} on OpenBSD
+| Running pnp4nagios on OpenBSD
 +-----------------------------------------------------------------------

-Log file in /var/log/pnp4nagios will need to be rotated. Here is a sample
-line for newsyslog.conf:
+General
+=======

-/var/log/pnp4nagios/pnp4nagios.log _icinga:_icinga 644 7  250  * Z
+Pnp4nagios has no default runtime dependencies to a monitoring tool,
+as well as to a monitoring webinterface or web server. Example
+instructions below are given for icinga, icinga-web and Apache2, as
+well as icinga2, icinga-web2 and nginx.
+
+Log file in ${VARBASE}/log/pnp4nagios will need to be rotated. Here is
+a sample line for newsyslog.conf:
+
+${VARBASE}/log/pnp4nagios/pnp4nagios.log _icinga:_icinga 644 7  250  * Z
+
+Icinga, Icinga-web, Apache
+==========================
+
+Apache2 configuration
+---------------------
+Apache2 configuration for PNP4Nagios is stored under:
+    ${VARBASE}/www/conf/modules.sample/pnp4nagios.conf
+
+It needs to be enabled by running the following command:
+# ln -s ../modules.sample/pnp4nagios.conf ${VARBASE}/www/conf/modules
+# rcctl restart apache2
+
+Icinga-web configuration
+------------------------
+To integrate PNP4Nagios into the Icinga Web frontend you will need to
+install templates extensions which comes with icinga-web package:
+% cd ${VARBASE}/www/icinga-web/app/modules/Cronks/data/xml/extensions
+# ln -s pnp-host-extension.xml.dist pnp-host-extension.xml
+# ln -s pnp-service-extension.xml.dist pnp-service-extension.xml
+
+Icinga2, Icinga-web2, Nginx
+===========================
+Pnp4nagios runs with php_fpm behind nginx in a chrooted environment.
+
+Prepare the chroot environment
+------------------------------
+ - follow the instructions in the rrdtool package README
+   to chroot rrdtool
+ - copy /bin/sh to ${VARBASE}/www/bin
+ - copy ${SYSCONFDIR}/pnp4nagios ${VARBASE}/www${SYSCONFDIR}/pnp4nagios
+ - copy ${LOCALBASE}/lib/kohana/system 
${VARBASE}/www${LOCALBASE}/lib/kohana/system
+ - edit ${VARBASE}/www${SYSCONFDIR}/pnp4nagios/config.php
+   - ensure: $conf['rrdbase'] = "/pnp4nagios/rrd/";
+   - ensure: $conf['nagios_base'] = "/icingaweb2";
+
+Icinga2 configuration
+---------------------
+With Icinga2 enable the perfdata feature:
+
+# icinga2 feature enable perfdata
+
+Pnp4nagios will use the npcd daemon, and work in the 'bulk' mode.
+In ${SYSCONFDIR}/pnp4nagios/npcd.cfg update the 'perfdata_spool_dir'
+to point to '${VARBASE}/spool/icinga2/perfdata'. Additionally ensure
+the 'perfdata_file_run_cmd_args' has a '--bulk' argument specified.
+
+In ${SYSCONFDIR}/pnp4nagios/process_perfdata.cfg ensure the
+RRDPATH setting points to '${VARBASE}/www/pnp4nagios/rrd'.
+
+Finally enable npcd:
+
+# rcctl enable npcd
+
+Nginx configuration
+-------------------
+Below a minimal snippet for the nginx configuration:
+
+server {
+
+  ...
+
+  location /pnp4nagios {
+
+    alias /var/www/pnp4nagios;
+  }
+
+  location ~ ^(/pnp4nagios.*\.php)(.*)$ {
+
+
+    root          /pnp4nagios;
+    include       ${SYSCONFDIR}/nginx/fastcgi_params;
+
+    fastcgi_pass  unix:run/php-fpm-pnp4nagios.sock;
+    fastcgi_split_path_info ^(.+\.php)(.*)$;
+    fastcgi_param PATH_INFO       $fastcgi_path_info;
+    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
+  }
+}
+
+Php_fpm configuration
+---------------------
+Configure php_fpm pool, the most important configuration
+entries:
+
+[pnp4nagios]
+listen = ${VARBASE}/www/run/php-fpm-pnp4nagios.sock
+listen.owner = www
+listen.group = www
+listen.mode = 0660
+user = _icinga
+group = _icinga
+chroot = ${VARBASE}/www
+
+Icinga-web2 configuration
+-------------------------
+Pnp4nagios integration with Icinga-web2 is done via PNP
+module, that can be found here:
+ - https://github.com/Icinga/icingaweb2-module-pnp
+For installation and configuration follow the modules
+instructions.


Reply via email to