1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 DESCRIPTION="A performance data analyzer for nagios"
7 HOMEPAGE="http://www.pnp4nagios.org/"
8 SRC_URI="mirror://sourceforge/${PN}/PNP-0.6/${P}.tar.gz"
12 IUSE="apache2 icinga +nagios"
13 KEYWORDS="amd64 ppc ppc64 ~sparc x86"
15 REQUIRED_USE="^^ ( icinga nagios )"
17 # Some things (sync mode, for one) are broken with nagios-4.x, but since
18 # nagios-3.x has been end-of-life'd, we don't have much choice here but
21 dev-lang/php:*[filter,gd,json,simplexml,xml,zlib]
22 net-analyzer/rrdtool[graph,perl]
23 icinga? ( net-analyzer/icinga2 )
24 nagios? ( net-analyzer/nagios-core )"
26 # A list of modules used in our Apache config file.
27 APACHE_MODS="apache2_modules_alias," # "Alias" directive
28 APACHE_MODS+="apache2_modules_authz_core," # "Require" directive
29 APACHE_MODS+="apache2_modules_rewrite" # "RewriteEngine" and friends
32 virtual/perl-Getopt-Long
33 virtual/perl-Time-HiRes
35 apache2? ( >=www-servers/apache-2.4[${APACHE_MODS}] )"
37 PATCHES=( "${FILESDIR}/${PN}-0.6.14-makefile.patch" )
40 local user_group=nagios
41 use icinga && user_group=icinga
44 --sysconfdir="${EPREFIX}"/etc/pnp \
45 --datarootdir="${EPREFIX}"/usr/share/pnp \
46 --localstatedir="${EPREFIX}"/var/lib/pnp \
47 --with-nagios-user="${user_group}" \
48 --with-nagios-group="${user_group}" \
49 --with-perfdata-logfile="${EPREFIX}"/var/log/pnp/process_perfdata.log
53 # The default target just shows a help
58 # Don't use INSTALL_OPTS because they set insecure permissions on
59 # all of /etc/pnp (https://github.com/lingej/pnp4nagios/issues/140).
60 emake INSTALL_OPTS="" DESTDIR="${D}" install install-config
62 newinitd "${FILESDIR}"/npcd.initd npcd
63 rm "${ED%/}/usr/share/pnp/install.php" || \
64 die "unable to remove ${ED%/}/usr/share/pnp/install.php"
66 # Fix CVE-2012-3457 (Gentoo bug 430358)
67 fperms o-rwx /etc/pnp/process_perfdata.cfg
70 insinto /etc/apache2/modules.d
71 newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf
74 # The nagios or icinga user needs to write performance data to the
76 local user_group=nagios
77 use icinga && user_group=icinga
78 fowners ":${user_group}" /var/lib/pnp/{,perfdata,spool}
79 fperms g+rwx /var/lib/pnp/{,perfdata,spool}
81 # and likewise for its logs...
83 fowners ":${user_group}" /var/log/pnp
84 fperms g+rwx /var/log/pnp
86 # and its statistics. This one is arguably the responsibility of the
87 # build system, since process_perfdata.cfg refers to this location.
88 dodir /var/lib/pnp/stats
89 fowners ":${user_group}" /var/lib/pnp/stats
90 fperms g+rwx /var/lib/pnp/stats
94 elog "To enable the pnp4nagios web front-end, please visit"
95 elog "${EROOT%/}/etc/conf.d/apache2 and add \"-D PNP -D PHP\""
96 elog "to APACHE2_OPTS. Then pnp4nagios will be available at,"
98 elog " http://localhost/pnp4nagios"