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?

I tried to add the most important pieces to the READMEs for icinga2
as well as the chrooted nginx/php_fpm/icinga-web2 setup.
Getting it running in a chroot, and producing graphs, caused me loosing
some hair over the last couple of days. Since information about running
it chrooted is more or less inexistent on the web.

Likely wording or the like could be improved ;)
How is that for a start?

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    20 May 2016 19:13:59 -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/README-cgi
===================================================================
RCS file: /cvs/ports/www/pnp4nagios/pkg/README-cgi,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 README-cgi
--- pkg/README-cgi      26 Apr 2016 10:12:29 -0000      1.1.1.1
+++ pkg/README-cgi      20 May 2016 19:13:59 -0000
@@ -4,6 +4,11 @@
 | Running ${FULLPKGNAME} on OpenBSD
 +-----------------------------------------------------------------------

+${FULLPKGNAME} has no default runtime dependencies to a monitoring
+webinterface. Either install 'icinga-web' or 'icinga-web2' package.
+
+You can use ${FULLPKGNAME} with Apache2 or nginx.
+
 Apache2
 -------
 Apache2 configuration for PNP4Nagios is stored under:
@@ -21,3 +26,65 @@
 % 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
+
+
+Chrooted nginx, php_fpm, icinga-web2, rrdtool
+---------------------------------------------
+
+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 /usr/local/lib/kohana/system 
${VARBASE}/www/usr/local/lib/kohana/system
+  * edit ${VARBASE}/www${SYSCONFDIR}/pnp4nagios/config.php
+    * ensure: $conf['rrdbase'] = "/pnp4nagios/rrd/";
+    * ensure: $conf['nagios_base'] = "/icingaweb2";
+
+
+To run ${FULLPKGNAME} chrooted behind nginx configure following
+locations in your server:
+
+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;
+  }
+}
+
+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
+
+Configure Icinga2 PNP module:
+  * Download the module from GitHub:
+    * https://github.com/Icinga/icingaweb2-module-pnp
+    * install as ${VARBASE}/www/icinga-web2/modules/pnp
+    * enable the module in the web frontent, and configure it:
+      * PNP4Nagios configuration: ${SYSCONFDIR}/pnp4nagios
+      * PNP4Nagios url: /pnp4nagios/index.php
+
+# rcctl enable php56_fpm
+# rcctl enable nginx
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     20 May 2016 19:13:59 -0000
@@ -4,7 +4,31 @@
 | Running ${FULLPKGNAME} on OpenBSD
 +-----------------------------------------------------------------------

-Log file in /var/log/pnp4nagios will need to be rotated. Here is a sample
+${FULLPKGNAME} has no default runtime dependencies to a monitoring tool.
+Either install 'icinga' or 'icinga2' packages.
+
+Log file in ${VARBASE}/log/pnp4nagios will need to be rotated. Here is a sample
 line for newsyslog.conf:

-/var/log/pnp4nagios/pnp4nagios.log _icinga:_icinga 644 7  250  * Z
+${VARBASE}/log/pnp4nagios/pnp4nagios.log _icinga:_icinga 644 7  250  * Z
+
+Icinga2
+-------
+
+With Icinga2 enable the perfdata feature:
+
+# icinga2 feature enable perfdata
+
+And restart icinga2
+
+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


Reply via email to