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/munin/
Date: Fri, 02 Dec 2022 00:50:18
Message-Id: 1669942213.de75489d0f7b6acabc313146e3f2cb6769f5df09.robbat2@gentoo
1 commit: de75489d0f7b6acabc313146e3f2cb6769f5df09
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 2 00:48:22 2022 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 2 00:50:13 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de75489d
7
8 net-analyzer/munin: fix annoying Date::Manip::DM5 cronspam
9
10 If you run munin every 5 mins from a cron, this spams cron logs every
11 time; upstream fixed it more than 8 years in master for another reason,
12 but never backported the fix.
13
14 Reference: https://groups.google.com/g/linux.debian.bugs.dist/c/qPscwQev_UU?pli=1
15 Reference: https://github.com/munin-monitoring/munin/commit/47a2ea75899a6395a80918d043a21d61fe712b44
16 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
17
18 net-analyzer/munin/Manifest | 1 +
19 net-analyzer/munin/munin-2.0.69-r1.ebuild | 420 ++++++++++++++++++++++++++++++
20 2 files changed, 421 insertions(+)
21
22 diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest
23 index a9b904ac9c62..f4701d18726c 100644
24 --- a/net-analyzer/munin/Manifest
25 +++ b/net-analyzer/munin/Manifest
26 @@ -2,3 +2,4 @@ DIST munin-2.0.67-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051
27 DIST munin-2.0.67.tar.gz 2258670 BLAKE2B 374b336403433d612b7998c77e6eb4f0eb68ffda4204ae6bc3c303f7667154c2ce606ffa27226c5644f3e6f71655c939b749da925136f59be4762891af49e2b1 SHA512 a8381491dfa15572438d9acda7a09feb0c3918ebe49e7bcfce5c172b36b4a5a0472bd6d06f5fad41270af0510b3fe115509d146f372df7fa47ed4aa1ec5f95d4
28 DIST munin-2.0.69-gentoo-1.tar.xz 3980 BLAKE2B 5aae9c29befa761f797d362c90d810051a7f3a5dc8250776ab6ae1659197d795dfb87274db66ff0a3deb4e10e14ced5b3765551a3f29357c436968a848f450ea SHA512 b21d6590bb9e1da127066a06818f1f3157362762f80526e2231b926956959e62af575f38235f72326376dc21bba63f9767efa379f1f2558ca9b20ddf5395e851
29 DIST munin-2.0.69.tar.gz 2258024 BLAKE2B 2d270f6f67fc9a86a592e2b7cbcf4111d6ae40bf1928b0ad0adb99ad32384810e5768c17019f9163e8b22fd8524b28257df527df023db9c1ba333691b384dd74 SHA512 4976e394e046d3fe1cbb000acdf081060188517e09abcf8b60dd7c55e0e1cdf46e33d1760368cb1423dfb9286e397df2072a2c55ba8b79adeae4ea2303130667
30 +DIST munin-remove-Date-Manip-DM5.patch 3587 BLAKE2B fab1fb61607e83aac5cbd699c93015d77ca6e58d9734a5a6bc17af6c3c7695ddf4257104cd69db4d3b3e1d36bb1d66a1893ddb51bfc52d0a1dd2efb3ba32a9c0 SHA512 976d7a50de6437a26fa77917368ab604c1987f686030e097c200fe9ebebd08e5fae10c04640cadbfecef90eda76ba123cf303d2d671cefa78b09752d1f6757af
31
32 diff --git a/net-analyzer/munin/munin-2.0.69-r1.ebuild b/net-analyzer/munin/munin-2.0.69-r1.ebuild
33 new file mode 100644
34 index 000000000000..84e8a56bb83b
35 --- /dev/null
36 +++ b/net-analyzer/munin/munin-2.0.69-r1.ebuild
37 @@ -0,0 +1,420 @@
38 +# Copyright 1999-2022 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=7
42 +
43 +PATCHSET=1
44 +
45 +inherit java-pkg-opt-2 systemd tmpfiles
46 +
47 +MY_P=${P/_/-}
48 +
49 +DESCRIPTION="Munin Server Monitoring Tool"
50 +HOMEPAGE="https://munin-monitoring.org/"
51 +SRC_URI="
52 + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz
53 + https://dev.gentoo.org/~graaff/munin/${P}-gentoo-${PATCHSET}.tar.xz
54 + https://github.com/munin-monitoring/munin/commit/47a2ea75899a6395a80918d043a21d61fe712b44.patch -> munin-remove-Date-Manip-DM5.patch
55 + "
56 +
57 +LICENSE="GPL-2"
58 +SLOT="0"
59 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
60 +IUSE="asterisk irc java ldap memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2"
61 +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )"
62 +RESTRICT="!test? ( test )"
63 +
64 +# Upstream's listing of required modules is NOT correct!
65 +# Some of the postgres plugins use DBD::Pg, while others call psql directly.
66 +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
67 +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
68 +DEPEND_COM="
69 + acct-user/munin
70 + acct-user/munin-async
71 + acct-group/munin
72 + dev-lang/perl:=[berkdb]
73 + dev-perl/DBI
74 + dev-perl/File-Copy-Recursive
75 + dev-perl/List-MoreUtils
76 + dev-perl/Log-Log4perl
77 + dev-perl/Net-CIDR
78 + dev-perl/Net-DNS
79 + dev-perl/Net-Netmask
80 + dev-perl/Net-SNMP
81 + dev-perl/Net-Server[ipv6(-)?]
82 + dev-perl/TimeDate
83 + virtual/perl-Digest-MD5
84 + virtual/perl-Getopt-Long
85 + virtual/perl-MIME-Base64
86 + virtual/perl-Storable
87 + virtual/perl-Text-Balanced
88 + virtual/perl-Time-HiRes
89 + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] )
90 + asterisk? ( dev-perl/Net-Telnet )
91 + cgi? (
92 + dev-perl/FCGI
93 + dev-perl/CGI-Fast
94 + )
95 + dhcpd? (
96 + >=net-misc/dhcp-3[server]
97 + dev-perl/Net-IP
98 + dev-perl/HTTP-Date
99 + )
100 + doc? ( dev-python/sphinx )
101 + http? ( dev-perl/libwww-perl )
102 + irc? ( dev-perl/Net-IRC )
103 + ldap? ( dev-perl/perl-ldap )
104 + kernel_linux? ( sys-process/procps )
105 + memcached? ( dev-perl/Cache-Memcached )
106 + mysql? (
107 + virtual/mysql
108 + dev-perl/Cache-Cache
109 + dev-perl/DBD-mysql
110 + )
111 + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* )
112 + ssl? ( dev-perl/Net-SSLeay )
113 + syslog? ( virtual/perl-Sys-Syslog )
114 + !minimal? (
115 + dev-perl/HTML-Template
116 + dev-perl/IO-Socket-INET6
117 + dev-perl/URI
118 + >=net-analyzer/rrdtool-1.3[graph,perl]
119 + virtual/ssh
120 + )
121 + "
122 +
123 +# Keep this seperate, as previous versions have had other deps here
124 +DEPEND="${DEPEND_COM}
125 + dev-perl/Module-Build
126 + java? ( >=virtual/jdk-1.8 )
127 + test? (
128 + dev-perl/Test-Deep
129 + dev-perl/Test-Exception
130 + dev-perl/Test-LongString
131 + dev-perl/Test-Differences
132 + dev-perl/Test-MockModule
133 + dev-perl/Test-MockObject
134 + dev-perl/File-Slurp
135 + dev-perl/IO-stringy
136 + dev-perl/IO-Socket-INET6
137 + )"
138 +RDEPEND="${DEPEND_COM}
139 + virtual/awk
140 + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 )
141 + java? (
142 + >=virtual/jre-1.8:*
143 + || ( net-analyzer/netcat net-analyzer/openbsd-netcat )
144 + )
145 + !minimal? (
146 + virtual/cron
147 + media-fonts/dejavu
148 + )
149 + selinux? ( sec-policy/selinux-munin )"
150 +
151 +S="${WORKDIR}/${MY_P}"
152 +
153 +pkg_setup() {
154 + java-pkg-opt-2_pkg_setup
155 +}
156 +
157 +src_prepare() {
158 + echo ${PV} > RELEASE || die
159 +
160 + eapply "${WORKDIR}"/patches/*.patch
161 + # Quick hack to make the munin-remove-Date-Manip-DM5.patch apply
162 + sed -i -e '/^BEGIN/,/Date::Manip::Backend/{ /no warnings;/d }' "${S}"/master/_bin/munin-cgi-graph.in
163 + eapply "${DISTDIR}"/munin-remove-Date-Manip-DM5.patch
164 +
165 + eapply_user
166 +
167 + java-pkg-opt-2_src_prepare
168 +}
169 +
170 +src_configure() {
171 + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi'
172 + use cgi || cgidir="${T}/useless/cgi-bin"
173 +
174 + local cgiuser=$(usex apache2 apache munin)
175 +
176 + cat >> "${S}"/Makefile.config <<- EOF || die
177 + PREFIX=\$(DESTDIR)/usr
178 + CONFDIR=\$(DESTDIR)/etc/munin
179 + DOCDIR=${T}/useless/doc
180 + MANDIR=\$(PREFIX)/share/man
181 + LIBDIR=\$(PREFIX)/libexec/munin
182 + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
183 + CGIDIR=${cgidir}
184 + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi
185 + CGIUSER=${cgiuser}
186 + DBDIR=\$(DESTDIR)/var/lib/munin
187 + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node
188 + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async
189 + LOGDIR=\$(DESTDIR)/var/log/munin
190 + PERLLIB=\$(DESTDIR)$(perl -V:vendorlib | cut -d"'" -f2)
191 + JCVALID=$(usex java yes no)
192 + STATEDIR=\$(DESTDIR)/run/munin
193 + EOF
194 +}
195 +
196 +# parallel make and install need to be fixed before, and I haven't
197 +# gotten around to do so yet.
198 +src_compile() {
199 + emake -j1
200 + use doc && emake -C doc html
201 +}
202 +
203 +src_test() {
204 + if [[ ${EUID} == 0 ]]; then
205 + eerror "You cannot run tests as root."
206 + eerror "Please enable FEATURES=userpriv before proceeding."
207 + return 1
208 + fi
209 +
210 + local testtargets="test-common test-node test-plugins"
211 + use minimal || testtargets+=" test-master"
212 +
213 + LC_ALL=C emake -j1 ${testtargets}
214 +}
215 +
216 +src_install() {
217 + local dirs="
218 + /var/log/munin
219 + /var/lib/munin/plugin-state
220 + /var/lib/munin-node/plugin-state
221 + /var/www/localhost/htdocs/munin
222 + /etc/munin/plugin-conf.d
223 + /etc/munin/plugins"
224 + use minimal || dirs+=" /etc/munin/munin-conf.d/"
225 +
226 + keepdir ${dirs}
227 + fowners munin:munin ${dirs}
228 +
229 + # parallel install doesn't work and it's also pointless to have this
230 + # run in parallel for now (because it uses internal loops).
231 + emake -j1 CHOWN=true DESTDIR="${D}" $(usex minimal "install-minimal install-man" install)
232 +
233 + # we remove /run from the install, as it's not the package's to deal
234 + # with.
235 + rm -rf "${D}"/run || die
236 +
237 + # remove the plugins for non-Gentoo package managers; use -f so that
238 + # it doesn't fail when installing on non-Linux platforms.
239 + rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
240 +
241 + insinto /etc/munin/plugin-conf.d/
242 + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
243 +
244 + newinitd "${FILESDIR}"/munin-node_init.d_2.0.19 munin-node
245 + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
246 +
247 + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd
248 +
249 + newtmpfiles - ${CATEGORY}:${PN}:${SLOT}.conf <<-EOF || die
250 + d /run/munin 0700 munin munin - -
251 + EOF
252 +
253 + systemd_dounit "${FILESDIR}"/munin-async.service
254 + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket}
255 + systemd_dounit "${FILESDIR}"/munin-html.{service,socket}
256 + systemd_dounit "${FILESDIR}"/munin-node.service
257 +
258 + cat >> "${T}"/munin.env <<- EOF
259 + CONFIG_PROTECT=/var/spool/munin-async/.ssh
260 + EOF
261 + newenvd "${T}"/munin.env 50munin
262 +
263 + dodoc README ChangeLog INSTALL
264 + if use doc; then
265 + cd "${S}"/doc/_build/html || die
266 + docinto html
267 + dodoc -r *
268 + cd "${S}" || die
269 + fi
270 +
271 + dodir /etc/logrotate.d/
272 + sed -e "s:@CGIUSER@:$(usex apache2 apache munin):g" \
273 + "${FILESDIR}"/logrotate.d-munin.3 > "${D}"/etc/logrotate.d/munin
274 +
275 + dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
276 +
277 + if use syslog; then
278 + sed -i -e '/log_file/s| .*| Sys::Syslog|' \
279 + "${D}"/etc/munin/munin-node.conf || die
280 + fi
281 +
282 + # Use a simpler pid file to avoid trouble with /run in tmpfs. The
283 + # munin-node service is ran as user root, and only later drops
284 + # privileges.
285 + sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \
286 + "${D}"/etc/munin/munin-node.conf || die
287 +
288 + keepdir /var/spool/munin-async/.ssh
289 + touch "${D}"/var/spool/munin-async/.ssh/authorized_keys
290 + fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}}
291 + fperms 0750 /var/spool/munin-async{,/.ssh}
292 + fperms 0600 /var/spool/munin-async/.ssh/authorized_keys
293 +
294 + if use minimal; then
295 + # This requires the presence of munin-update, which is part of
296 + # the non-minimal install...
297 + rm "${D}"/usr/libexec/munin/plugins/munin_stats
298 + else
299 + # remove font files so that we don't have to keep them around
300 + rm "${D}"/usr/libexec/${PN}/*.ttf || die
301 +
302 + if use cgi; then
303 + sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
304 +
305 + touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log
306 + fowners $(usex apache2 apache munin) \
307 + /var/log/munin/munin-cgi-{graph,html}.log
308 +
309 + if use apache2; then
310 + insinto /etc/apache2/vhosts.d
311 + newins "${FILESDIR}"/munin.apache.include munin.include
312 + newins "${FILESDIR}"/munin.apache.include-2.4 munin-2.4.include
313 + fi
314 + else
315 + sed \
316 + -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \
317 + -i "${D}"/etc/munin/munin.conf || die
318 + fi
319 +
320 + keepdir /var/lib/munin/.ssh
321 + cat >> "${D}"/var/lib/munin/.ssh/config <<- EOF
322 + IdentityFile /var/lib/munin/.ssh/id_ecdsa
323 + IdentityFile /var/lib/munin/.ssh/id_rsa
324 + EOF
325 +
326 + fowners munin:munin /var/lib/munin/.ssh/{,config}
327 + fperms go-rwx /var/lib/munin/.ssh/{,config}
328 +
329 + dodir /usr/share/${PN}
330 + cat >> "${D}"/usr/share/${PN}/crontab <<- EOF
331 + # Force the shell to bash
332 + SHELL=/bin/bash
333 + # Mail reports to root@, not munin@
334 + MAILTO=root
335 +
336 + # This runs the munin task every 5 minutes.
337 + */5 * * * * /usr/bin/munin-cron
338 +
339 + # Alternatively, this route works differently
340 + # Update once a minute (for busy sites)
341 + #*/1 * * * * /usr/libexec/munin/munin-update
342 + ## Check for limit excess every 2 minutes
343 + #*/2 * * * * /usr/libexec/munin/munin-limits
344 + ## Update graphs every 5 minutes
345 + #*/5 * * * * nice /usr/libexec/munin/munin-graph
346 + ## Update HTML pages every 15 minutes
347 + #*/15 * * * * nice /usr/libexec/munin/munin-html
348 + EOF
349 +
350 + cat >> "${D}"/usr/share/${PN}/fcrontab <<- EOF
351 + # Mail reports to root@, not munin@, only execute one at a time
352 + !mailto(root),serial(true)
353 +
354 + # This runs the munin task every 5 minutes.
355 + @ 5 /usr/bin/munin-cron
356 +
357 + # Alternatively, this route works differently
358 + # Update once a minute (for busy sites)
359 + #@ 1 /usr/libexec/munin/munin-update
360 + ## Check for limit excess every 2 minutes
361 + #@ 2 /usr/libexec/munin/munin-limits
362 + ## Update graphs every 5 minutes
363 + #@ 5 nice /usr/libexec/munin/munin-graph
364 + ## Update HTML pages every 15 minutes
365 + #@ 15 nice /usr/libexec/munin/munin-html
366 + EOF
367 +
368 + # remove .htaccess file
369 + find "${D}" -name .htaccess -delete || die
370 + fi
371 +}
372 +
373 +pkg_config() {
374 + if use minimal; then
375 + einfo "Nothing to do."
376 + return 0
377 + fi
378 +
379 + einfo "Press enter to install the default crontab for the munin master"
380 + einfo "installation from /usr/share/${PN}/f?crontab"
381 + einfo "If you have a large site, you may wish to customize it."
382 + read
383 +
384 + ebegin "Setting up cron ..."
385 + if has_version sys-process/fcron; then
386 + fcrontab - -u munin < /usr/share/${PN}/fcrontab
387 + else
388 + # dcron is very fussy about syntax
389 + # the following is the only form that works in BOTH dcron and vixie-cron
390 + crontab - -u munin < /usr/share/${PN}/crontab
391 + fi
392 + eend $?
393 +
394 + einfo "Press enter to set up the SSH keys used for SSH transport"
395 + read
396 +
397 + # generate one rsa (for legacy) and one ecdsa (for new systems)
398 + ssh-keygen -t rsa \
399 + -f /var/lib/munin/.ssh/id_rsa -N '' \
400 + -C "created by portage for ${CATEGORY}/${PN}" || die
401 + ssh-keygen -t ecdsa \
402 + -f /var/lib/munin/.ssh/id_ecdsa -N '' \
403 + -C "created by portage for ${CATEGORY}/${PN}" || die
404 + chown -R munin:munin /var/lib/munin/.ssh || die
405 + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die
406 +
407 + einfo "Your public keys are available in "
408 + einfo " /var/lib/munin/.ssh/id_rsa.pub"
409 + einfo " /var/lib/munin/.ssh/id_ecdsa.pub"
410 + einfo "and follows for convenience"
411 + echo
412 + cat /var/lib/munin/.ssh/id_*.pub
413 +}
414 +
415 +pkg_postinst() {
416 + tmpfiles_process ${CATEGORY}:${PN}:${SLOT}.conf
417 +
418 + elog "Please follow the munin documentation to set up the plugins you"
419 + elog "need, afterwards start munin-node."
420 + elog ""
421 + elog "To make use of munin-async, make sure to set up the corresponding"
422 + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys"
423 + elog ""
424 + if ! use minimal; then
425 + elog "Please run"
426 + elog " emerge --config net-analyzer/munin"
427 + elog "to automatically configure munin's cronjobs as well as generate"
428 + elog "passwordless SSH keys to be used with munin-async."
429 + fi
430 + elog ""
431 + elog "Further information about setting up Munin in Gentoo can be found"
432 + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
433 +
434 + if use cgi; then
435 + chown $(usex apache2 apache munin) \
436 + "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log
437 +
438 + if use apache2; then
439 + elog "To use Munin with CGI you should include /etc/apache2/vhosts.d/munin.include"
440 + elog "or /etc/apache2/vhosts.d/munin-2.4.include (for Apache 2.4) from the virtual"
441 + elog "host you want it to be served."
442 + elog "If you want to enable CGI-based HTML as well, you have to add to"
443 + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI."
444 + else
445 + elog "Effective CGI support has just been added in 2.0.7-r6."
446 + elog "Documentation on how to use it is still sparse."
447 + fi
448 + fi
449 +
450 + # we create this here as we don't want Portage to check /run
451 + # symlinks but we still need this to be present before the reboot.
452 + if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then
453 + mkdir "${ROOT}"/run/munin
454 + chown munin:munin "${ROOT}"/run/munin
455 + chmod 0700 "${ROOT}"/run/munin
456 + fi
457 +}