Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/pnp4nagios/, net-analyzer/pnp4nagios/files/
Date: Thu, 28 Apr 2016 19:22:32
Message-Id: 1461871336.8bd5f7e2bcb80e5d45d7071f2c60baf366373cce.robbat2@gentoo
1 commit: 8bd5f7e2bcb80e5d45d7071f2c60baf366373cce
2 Author: Louis Sautier <sautier.louis <AT> gmail <DOT> com>
3 AuthorDate: Mon Apr 25 11:21:58 2016 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 28 19:22:16 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8bd5f7e2
7
8 net-analyzer/pnp4nagios: EAPI=6, support >=rrdtool-1.6.0
9
10 Package-Manager: portage-2.2.28
11 (cherry picked from commit 4ee6bc9b624d654038d28c15b39b901ac9d67b2b)
12 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
13
14 .../pnp4nagios-0.6.25-rrdtool-0.6.0-support.patch | 93 +++++++++++++++++
15 .../pnp4nagios/pnp4nagios-0.6.25-r3.ebuild | 110 +++++++++++++++++++++
16 2 files changed, 203 insertions(+)
17
18 diff --git a/net-analyzer/pnp4nagios/files/pnp4nagios-0.6.25-rrdtool-0.6.0-support.patch b/net-analyzer/pnp4nagios/files/pnp4nagios-0.6.25-rrdtool-0.6.0-support.patch
19 new file mode 100644
20 index 0000000..1a16d77
21 --- /dev/null
22 +++ b/net-analyzer/pnp4nagios/files/pnp4nagios-0.6.25-rrdtool-0.6.0-support.patch
23 @@ -0,0 +1,93 @@
24 +From 0a539e1c7ab03ec015c27e4ad0fe16343a98c269 Mon Sep 17 00:00:00 2001
25 +From: Louis Sautier <sautier.louis@×××××.com>
26 +Date: Mon, 25 Apr 2016 12:31:49 +0200
27 +Subject: [PATCH] Use complete option arguments for compatibility with rrdtool
28 + 1.6.0
29 +
30 +Since rrdtool switched to optparse, it seems that complete option
31 +arguments must be used:
32 +https://github.com/oetiker/rrdtool-1.x/commit/83530d3e43cebc32da157733d35c60bf4bb098da
33 +---
34 + share/pnp/templates.dist/check_dns.php | 2 +-
35 + share/pnp/templates.dist/check_multi.php | 2 +-
36 + share/pnp/templates.dist/check_ping_tick.php | 2 +-
37 + share/pnp/templates.dist/check_users.php | 2 +-
38 + share/pnp/templates.dist/default.php | 6 +++---
39 + 5 files changed, 7 insertions(+), 7 deletions(-)
40 +
41 +diff --git a/share/pnp/templates.dist/check_dns.php b/share/pnp/templates.dist/check_dns.php
42 +index b8ab048..dad209a 100644
43 +--- a/share/pnp/templates.dist/check_dns.php
44 ++++ b/share/pnp/templates.dist/check_dns.php
45 +@@ -4,7 +4,7 @@
46 + # Template for check_dns
47 + #
48 +
49 +-$opt[1] = "--lower=$MIN[1] --vertical-label $UNIT[1] --title \"DNS Response Time\" ";
50 ++$opt[1] = "--lower-limit=$MIN[1] --vertical-label $UNIT[1] --title \"DNS Response Time\" ";
51 +
52 +
53 + $def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:AVERAGE " ;
54 +diff --git a/share/pnp/templates.dist/check_multi.php b/share/pnp/templates.dist/check_multi.php
55 +index ba6bcd1..cd0794a 100644
56 +--- a/share/pnp/templates.dist/check_multi.php
57 ++++ b/share/pnp/templates.dist/check_multi.php
58 +@@ -4,7 +4,7 @@
59 + # Template for check_multi
60 + #
61 +
62 +-$opt[1] = "--lower=$MIN[1] --vertical-label num --title \"Number of Checks\" ";
63 ++$opt[1] = "--lower-limit=$MIN[1] --vertical-label num --title \"Number of Checks\" ";
64 + $ds_name[1] = "Executed Plugins";
65 +
66 + $def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:AVERAGE " ;
67 +diff --git a/share/pnp/templates.dist/check_ping_tick.php b/share/pnp/templates.dist/check_ping_tick.php
68 +index 865479f..f191049 100644
69 +--- a/share/pnp/templates.dist/check_ping_tick.php
70 ++++ b/share/pnp/templates.dist/check_ping_tick.php
71 +@@ -6,7 +6,7 @@
72 + # RTA
73 + #
74 + $ds_name[1] = "Round Trip Times";
75 +-$opt[1] = "--lower=0 --vertical-label \"RTA\" --title \"Ping times\" ";
76 ++$opt[1] = "--lower-limit=0 --vertical-label \"RTA\" --title \"Ping times\" ";
77 + $opt[1] .= rrd::darkteint();
78 + $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE") ;
79 + $def[1] .= rrd::ticker("var1", $WARN[1], $CRIT[1]) ;
80 +diff --git a/share/pnp/templates.dist/check_users.php b/share/pnp/templates.dist/check_users.php
81 +index 9fe878d..c66fc01 100644
82 +--- a/share/pnp/templates.dist/check_users.php
83 ++++ b/share/pnp/templates.dist/check_users.php
84 +@@ -4,7 +4,7 @@
85 + # Template for check_users
86 + #
87 +
88 +-$opt[1] = "--lower=$MIN[1] --vertical-label \"Users\" --title \"Users\" ";
89 ++$opt[1] = "--lower-limit=$MIN[1] --vertical-label \"Users\" --title \"Users\" ";
90 +
91 +
92 + $def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX " ;
93 +diff --git a/share/pnp/templates.dist/default.php b/share/pnp/templates.dist/default.php
94 +index 6fdf38c..823ee6a 100644
95 +--- a/share/pnp/templates.dist/default.php
96 ++++ b/share/pnp/templates.dist/default.php
97 +@@ -47,7 +47,7 @@
98 + $crit_min = $VAL['CRIT_MIN'];
99 + }
100 + if ( $VAL['MIN'] != "" && is_numeric($VAL['MIN']) ) {
101 +- $lower = " --lower=" . $VAL['MIN'];
102 ++ $lower = " --lower-limit=" . $VAL['MIN'];
103 + $minimum = $VAL['MIN'];
104 + }
105 + if ( $VAL['MAX'] != "" && is_numeric($VAL['MAX']) ) {
106 +@@ -55,8 +55,8 @@
107 + }
108 + if ($VAL['UNIT'] == "%%") {
109 + $vlabel = "%";
110 +- $upper = " --upper=101 ";
111 +- $lower = " --lower=0 ";
112 ++ $upper = " --upper-limit=101 ";
113 ++ $lower = " --lower-limit=0 ";
114 + }
115 + else {
116 + $vlabel = $VAL['UNIT'];
117
118 diff --git a/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r3.ebuild b/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r3.ebuild
119 new file mode 100644
120 index 0000000..974810a
121 --- /dev/null
122 +++ b/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r3.ebuild
123 @@ -0,0 +1,110 @@
124 +# Copyright 1999-2016 Gentoo Foundation
125 +# Distributed under the terms of the GNU General Public License v2
126 +# $Id$
127 +
128 +EAPI=6
129 +
130 +inherit depend.apache eutils
131 +
132 +DESCRIPTION="A performance data analyzer for nagios"
133 +HOMEPAGE="http://www.pnp4nagios.org/"
134 +SRC_URI="mirror://sourceforge/${PN}/PNP-0.6/${P}.tar.gz"
135 +
136 +LICENSE="GPL-2"
137 +SLOT="0"
138 +IUSE=""
139 +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
140 +
141 +# A lot of things (sync mode, for one) are broken with nagios-4.x.
142 +DEPEND="
143 + dev-lang/php:*[filter,gd,json,simplexml,xml,zlib]
144 + >=net-analyzer/rrdtool-1.2[graph,perl]
145 + || ( <net-analyzer/nagios-core-4 net-analyzer/icinga net-analyzer/icinga2 )"
146 +
147 +# A list of modules used in our Apache config file.
148 +APACHE_MODS="apache2_modules_alias," # "Alias" directive
149 +APACHE_MODS+="apache2_modules_authz_core," # "Require" directive
150 +APACHE_MODS+="apache2_modules_rewrite" # "RewriteEngine" and friends
151 +
152 +RDEPEND="${DEPEND}
153 + virtual/perl-Getopt-Long
154 + virtual/perl-Time-HiRes
155 + media-fonts/dejavu
156 + apache2? ( >=www-servers/apache-2.4[${APACHE_MODS}] )"
157 +
158 +PATCHES=(
159 + "${FILESDIR}/${PN}-0.6.14-makefile.patch"
160 + "${FILESDIR}/${P}-rrdtool-0.6.0-support.patch"
161 +)
162 +
163 +# There is no want_apache2_4, but we needed to specify that manually
164 +# anyway to be able to include the list of modules.
165 +want_apache2
166 +
167 +pkg_setup() {
168 + depend.apache_pkg_setup
169 +}
170 +
171 +src_configure() {
172 + local var_dir=
173 + local user_group=
174 +
175 + if has_version net-analyzer/nagios-core; then
176 + var_dir=/var/nagios/
177 + user_group=nagios
178 + elif has_version net-analyzer/icinga2; then
179 + var_dir=/var/lib/icinga2/
180 + user_group=icinga
181 + else
182 + var_dir=/var/lib/icinga/
183 + user_group=icinga
184 + fi
185 +
186 + econf \
187 + --sysconfdir=/etc/pnp \
188 + --datarootdir=/usr/share/pnp \
189 + --mandir=/usr/share/man \
190 + --with-perfdata-dir=${var_dir}/perfdata \
191 + --with-nagios-user=${user_group} \
192 + --with-nagios-group=${user_group} \
193 + --with-perfdata-logfile=${var_dir}/perfdata.log \
194 + --with-perfdata-spool-dir=/var/spool/pnp
195 +}
196 +
197 +src_compile() {
198 + # The default target just shows a help
199 + emake all
200 +}
201 +
202 +src_install() {
203 + emake DESTDIR="${D}" install install-config
204 + newinitd "${FILESDIR}"/npcd.initd npcd
205 + rm "${D}/usr/share/pnp/install.php" || \
206 + die "unable to remove ${D}/usr/share/pnp/install.php"
207 +
208 + if use apache2 ; then
209 + insinto "${APACHE_MODULES_CONFDIR}"
210 + newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf
211 +
212 + # Allow the apache user to read our config files. This same
213 + # approach is used in net-analyzer/nagios-core.
214 + chgrp -R apache "${D}/etc/pnp" \
215 + || die "failed to change group of ${ROOT}etc/pnp"
216 + fi
217 +
218 + # Bug 430358 - CVE-2012-3457
219 + find "${D}/etc/pnp" -type f -exec chmod 0640 '{}' + || \
220 + die "unable to set file permissions under ${D}/etc/pnp"
221 +
222 + find "${D}/etc/pnp" -type d -exec chmod 0750 '{}' + || \
223 + die "unable to set directory permissions under ${D}/etc/pnp"
224 +}
225 +
226 +pkg_postinst() {
227 + elog "To enable the pnp4nagios web front-end, please visit"
228 + elog "${ROOT}etc/conf.d/apache2 and add \"-D PNP -D PHP5\""
229 + elog "to APACHE2_OPTS. Then pnp4nagios will be available at,"
230 + elog
231 + elog " http://localhost/pnp4nagios"
232 + elog
233 +}