diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
| commit | b590c8d7572b727d565cc0b8ff660d43569845de (patch) | |
| tree | 06f7a4102ea4e845df8b66660f252920d52952f9 /net-analyzer/munin | |
| parent | 24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff) | |
| download | baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip | |
Adding metadata
Diffstat (limited to 'net-analyzer/munin')
24 files changed, 2026 insertions, 0 deletions
diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest new file mode 100644 index 000000000000..0cfaff703fd3 --- /dev/null +++ b/net-analyzer/munin/Manifest @@ -0,0 +1,2 @@ +DIST munin-2.0.75.tar.gz 2258514 BLAKE2B 689b436913a931c9002757267db236ba4ab1da947552c43ad2b96c2e5b26427499e681d0606d0045cfbbd90b70a69572b8550660a598d672babeba8388feacf5 SHA512 cceb47c27bfb3080980fd6342e805b5b9fecbef7033d6f2a83fe6c78d20f943961c9f1775ef5e464e49c25c9d246606594f2844827b38d34c04016f15dd68613 +DIST munin-2.0.76.tar.gz 2258538 BLAKE2B 74d8d055be52f605b2d0f2551328bd425e9550a7dd86740479f7a6efd9a9d8be7a78b4075fe68a9c658981b2089d6277eb51b758fb8ba341c149117457ab4696 SHA512 e43d8f123cb6bf9a1b99dde4fe93440e256b3950ec1f79923998f83b14530bba24dab87ece1d3e7e5bf3afd645eafa6c1055d1119748e76230cfb29136712086 diff --git a/net-analyzer/munin/files/logrotate.d-munin.3 b/net-analyzer/munin/files/logrotate.d-munin.3 new file mode 100644 index 000000000000..5133c47e8ba1 --- /dev/null +++ b/net-analyzer/munin/files/logrotate.d-munin.3 @@ -0,0 +1,33 @@ +/var/log/munin/munin-node.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 root root + postrotate + test -e /run/openrc/softlevel && /etc/init.d/munin-node restart 1>/dev/null || true + test -e /run/systemd/system && systemctl restart munin-node 1>/dev/null || true + endscript +} + +/var/log/munin/munin-update.log /var/log/munin/munin-graph.log /var/log/munin/munin-html.log /var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + nocreate +} + +/var/log/munin/munin-cgi-graph.log /var/log/munin/munin-cgi-html.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 @CGIUSER@ +} diff --git a/net-analyzer/munin/files/logrotate.d-munin.4 b/net-analyzer/munin/files/logrotate.d-munin.4 new file mode 100644 index 000000000000..8bbb6422620b --- /dev/null +++ b/net-analyzer/munin/files/logrotate.d-munin.4 @@ -0,0 +1,33 @@ +/var/log/munin/munin-node.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 root root + postrotate + test -e /run/openrc/softlevel && /etc/init.d/munin-node restart 1>/dev/null || true + test -e /run/systemd/system && systemctl restart munin-node 1>/dev/null || true + endscript +} + +/var/log/munin/munin-update.log /var/log/munin/munin-graph.log /var/log/munin/munin-html.log /var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + nocreate +} + +/var/log/munin/munin-cgi-graph.log /var/log/munin/munin-cgi-html.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 @CGIUSER@ root +} diff --git a/net-analyzer/munin/files/logrotate.d-munin.5 b/net-analyzer/munin/files/logrotate.d-munin.5 new file mode 100644 index 000000000000..8238d1a56bdf --- /dev/null +++ b/net-analyzer/munin/files/logrotate.d-munin.5 @@ -0,0 +1,33 @@ +/var/log/munin/munin-node.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 root root + postrotate + test -e /run/openrc/softlevel && /etc/init.d/munin-node --ifstarted restart 1>/dev/null || true + test -e /run/systemd/system && systemctl try-restart munin-node 1>/dev/null || true + endscript +} + +/var/log/munin/munin-update.log /var/log/munin/munin-graph.log /var/log/munin/munin-html.log /var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + nocreate +} + +/var/log/munin/munin-cgi-graph.log /var/log/munin/munin-cgi-html.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 @CGIUSER@ root +} diff --git a/net-analyzer/munin/files/munin-1.3.2-plugins.conf b/net-analyzer/munin/files/munin-1.3.2-plugins.conf new file mode 100644 index 000000000000..e85666b77013 --- /dev/null +++ b/net-analyzer/munin/files/munin-1.3.2-plugins.conf @@ -0,0 +1,80 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# +# This file contains configuration options for the plugins. Three +# options are understood by munin-node itself: +# +# user <user> # Set the user to run the plugin as +# group <group> # Set the group to run the plugin as +# command <command> # Run <command> instead of the plugin. %c +# expands to what would normally be run. +# env.<variable> # Sets <variable> in the plugin's environment, see the +# individual plugins to find out which variables they +# care about. +# +# + +[smart_*] +user root +group disk + +# ipmitool and freeipmi need access to the IPMI device nodes, which +# are only readable by root +[ipmi_*] +user root + +[freeipmi_*] +user root + +# Example for a 3ware 8000-series card, with 2 disks +# use /dev/twe0 as the actual device +# and replicate this entry for each drive, increasing the number in -d +#[smart_3ware-0_twe0] +#user root +#group root +#env.smartargs -H -i -c -l error -l selftest -l selective -a -d 3ware,0 +#[smart_3ware-1_twe0] +#user root +#group root +#env.smartargs -H -i -c -l error -l selftest -l selective -a -d 3ware,1 + +[bind9*] +user root + +[iostat*] +user munin +group munin + +[iostat_ios] +user root +group disk + +[vlan*] +user root + +[postfix*] +user root +env.logfile maillog + +[sendmail*] +env.mspqueue /var/spool/clientmqueue + +[mysql*] +#env.mysqlopts -u someuser + +[exim*] +group mail + +[cps*] +user root + +[mailman] +env.logfile /var/lib/mailman/logs/post +env.libdir /var/lib/mailman +env.lister /usr/lib/mailman/bin/list_members + +# More 3ware examples +#[hddtemp_smartctl] +#env.drives twe0_0 twe0_1 hda +#env.type_twe0_0 3ware,0 +#env.type_twe0_1 3ware,1 diff --git a/net-analyzer/munin/files/munin-async.service b/net-analyzer/munin/files/munin-async.service new file mode 100644 index 000000000000..add6d238f456 --- /dev/null +++ b/net-analyzer/munin/files/munin-async.service @@ -0,0 +1,10 @@ +[Unit] +Description=Munin Async Service +After=syslog.target network.target + +[Service] +PIDFile=/run/munin/munin-asyncd.pid +ExecStart=/usr/libexec/munin/munin-asyncd + +[Install] +WantedBy=multi-user.target diff --git a/net-analyzer/munin/files/munin-asyncd.init.2 b/net-analyzer/munin/files/munin-asyncd.init.2 new file mode 100644 index 000000000000..c9fc267f12ea --- /dev/null +++ b/net-analyzer/munin/files/munin-asyncd.init.2 @@ -0,0 +1,20 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +command=/usr/libexec/munin/munin-asyncd +command_args="--fork" +pidfile="/run/munin-asyncd.pid" +command_background="yes" +command_user="munin-async" + +depend() { + need munin-node + before cron +} + +start_pre() { + checkpath -d -o munin-async:munin -m 0750 /var/spool/munin-async +} + +# vim: filetype=gentoo-init-d: diff --git a/net-analyzer/munin/files/munin-graph.service b/net-analyzer/munin/files/munin-graph.service new file mode 100644 index 000000000000..9aea1da64e95 --- /dev/null +++ b/net-analyzer/munin/files/munin-graph.service @@ -0,0 +1,11 @@ +[Unit] +Description=Munin FastCGI Graph +Requires=munin-graph.socket + +[Service] +User=munin +Group=munin +ExecStart=/usr/libexec/munin/munin-graph +StandardInput=socket +StandardOutput=inherit +StandardError=journal diff --git a/net-analyzer/munin/files/munin-graph.socket b/net-analyzer/munin/files/munin-graph.socket new file mode 100644 index 000000000000..533c709c50ec --- /dev/null +++ b/net-analyzer/munin/files/munin-graph.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Munin FastCGI Graph Socket + +[Socket] +ListenStream=/run/munin/fcgi-graph.sock + +[Install] +WantedBy=sockets.target diff --git a/net-analyzer/munin/files/munin-html.service b/net-analyzer/munin/files/munin-html.service new file mode 100644 index 000000000000..09fdf162722b --- /dev/null +++ b/net-analyzer/munin/files/munin-html.service @@ -0,0 +1,11 @@ +[Unit] +Description=Munin FastCGI HTML +Requires=munin-html.socket + +[Service] +User=munin +Group=munin +ExecStart=/usr/libexec/munin/munin-html +StandardInput=socket +StandardOutput=inherit +StandardError=journal diff --git a/net-analyzer/munin/files/munin-html.socket b/net-analyzer/munin/files/munin-html.socket new file mode 100644 index 000000000000..52fc3c354d33 --- /dev/null +++ b/net-analyzer/munin/files/munin-html.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Munin FastCGI HTML Socket + +[Socket] +ListenStream=/run/munin/fcgi-html.sock + +[Install] +WantedBy=sockets.target diff --git a/net-analyzer/munin/files/munin-node.service b/net-analyzer/munin/files/munin-node.service new file mode 100644 index 000000000000..92c314b6ec33 --- /dev/null +++ b/net-analyzer/munin/files/munin-node.service @@ -0,0 +1,11 @@ +[Unit] +Description=Munin Node Service +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/run/munin-node.pid +ExecStart=/usr/sbin/munin-node + +[Install] +WantedBy=multi-user.target diff --git a/net-analyzer/munin/files/munin-node_conf.d_1.4.6-r2 b/net-analyzer/munin/files/munin-node_conf.d_1.4.6-r2 new file mode 100644 index 000000000000..79b0e14ef7fd --- /dev/null +++ b/net-analyzer/munin/files/munin-node_conf.d_1.4.6-r2 @@ -0,0 +1,7 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Set to the nice level for daemon +NICE_LEVEL=1 + +# vim: filetype=gentoo-conf-d: diff --git a/net-analyzer/munin/files/munin-node_init.d_2.0.73 b/net-analyzer/munin/files/munin-node_init.d_2.0.73 new file mode 100644 index 000000000000..ef9ff691adeb --- /dev/null +++ b/net-analyzer/munin/files/munin-node_init.d_2.0.73 @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +get_munin_config() { + awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE" +} + +: ${CFGFILE:=/etc/munin/munin-node.conf} + +command=/usr/sbin/munin-node +command_args="--config ${CFGFILE}" +pidfile=$(get_munin_config pid_file) +start_stop_daemon_args="--nicelevel ${NICE_LEVEL:-0} --wait 1500" +extra_started_commands="reload" + +depend() { + config "$CFGFILE" + + before cron + need hostname net + + [ "$(get_munin_config log_file)" = "Sys::Syslog" ] && \ + use logger +} + +# vim: filetype=gentoo-init-d: diff --git a/net-analyzer/munin/files/munin.apache.include-2.4-r1 b/net-analyzer/munin/files/munin.apache.include-2.4-r1 new file mode 100644 index 000000000000..290c2818eb9d --- /dev/null +++ b/net-analyzer/munin/files/munin.apache.include-2.4-r1 @@ -0,0 +1,29 @@ +# -*- apache -*- + +<IfDefine MUNIN_HTML_CGI> +RewriteEngine on + +RewriteRule ^/favicon.ico /static/favicon.ico [L] + +RewriteCond %{REQUEST_URI} (/|\.html)$ +RewriteCond %{REQUEST_URI} !/static +RewriteRule ^/(.*) /munin-cgi/munin-cgi-html/$1 [PT,L] +RewriteRule ^/munin-cgi/munin-cgi-graph/(.*) /$1 +RewriteCond %{REQUEST_URI} !^/static +RewriteRule ^/(.*.png) /munin-cgi/munin-cgi-graph/$1? [L,PT] + +ScriptAlias /munin-cgi/munin-cgi-graph /usr/libexec/munin/cgi/munin-cgi-graph +ScriptAlias /munin-cgi/munin-cgi-html /usr/libexec/munin/cgi/munin-cgi-html +</IfDefine> + +<Directory /usr/libexec/munin/cgi/> + Options +ExecCGI + Require all granted + + <IfModule mod_fcgid.c> + SetHandler fcgid-script + </IfModule> + <IfModule !mod_fcgid.c> + SetHandler cgi-script + </IfModule> +</Directory> diff --git a/net-analyzer/munin/files/patches/0002-build-create-an-install-minimal-target-that-only-ins.patch b/net-analyzer/munin/files/patches/0002-build-create-an-install-minimal-target-that-only-ins.patch new file mode 100644 index 000000000000..fee72bc23ad3 --- /dev/null +++ b/net-analyzer/munin/files/patches/0002-build-create-an-install-minimal-target-that-only-ins.patch @@ -0,0 +1,36 @@ +From 75ae794b1c497a82c4ce8f63c9d016cd11d3c7ba Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.eu> +Date: Sun, 21 Oct 2012 13:39:21 -0700 +Subject: [PATCH 2/7] build: create an install-minimal target that only + installs the Node components +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is what Gentoo does right now manually, it's easier to maintain +here though, and users might want to do the same if they are +installing from sources, and only want a node. + +Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu> +--- + Makefile | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index cdc3577..c119d38 100644 +--- a/Makefile ++++ b/Makefile +@@ -64,7 +64,9 @@ tags: + + ###################################################################### + +-install: install-master-prime install-common-prime install-node-prime install-plugins-prime $(JAVA_INSTALL) install-man install-async-prime ++install: install-master-prime install-minimal install-man ++ ++install-minimal: install-common-prime install-node-prime install-plugins-prime $(JAVA_INSTALL) install-async-prime + + install-pre: Makefile Makefile.config + @$(CHECKUSER) +-- +2.2.1 + diff --git a/net-analyzer/munin/files/patches/0003-master-make-it-possible-to-configure-the-default-cgi.patch b/net-analyzer/munin/files/patches/0003-master-make-it-possible-to-configure-the-default-cgi.patch new file mode 100644 index 000000000000..63897f552c9a --- /dev/null +++ b/net-analyzer/munin/files/patches/0003-master-make-it-possible-to-configure-the-default-cgi.patch @@ -0,0 +1,113 @@ +From b634d1396bc2fba170b414f09ea07d0de702fdb8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.eu> +Date: Sun, 4 Nov 2012 11:18:11 -0800 +Subject: [PATCH 3/7] master: make it possible to configure the default cgi-tmp + directory. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows distributions to use, for instance, /var/cache/munin-cgi, +so that /var/lib preserves its designed purpose. + +Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu> +--- + Makefile | 7 ++++--- + Makefile.config | 3 +++ + common/lib/Munin/Common/Defaults.pm | 2 +- + master/_bin/munin-cgi-graph.in | 2 +- + master/lib/Munin/Master/Config.pm | 2 +- + master/munin.conf.in | 2 +- + 6 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index c119d38..2e30052 100644 +--- a/Makefile ++++ b/Makefile +@@ -87,14 +87,14 @@ install-master-prime: $(INFILES_MASTER) install-pre install-master + mkdir -p $(PERLLIB)/Munin/Master + mkdir -p $(HTMLDIR) + mkdir -p $(DBDIR) +- mkdir -p $(DBDIR)/cgi-tmp ++ mkdir -p $(CGITMPDIR) + mkdir -p $(CGIDIR) + + $(CHOWN) $(USER) $(HTMLDIR) $(DBDIR) + $(CHMOD) 0755 $(DBDIR) + +- $(CHOWN) $(CGIUSER) $(DBDIR)/cgi-tmp +- $(CHMOD) 0755 $(DBDIR)/cgi-tmp ++ $(CHOWN) $(CGIUSER) $(CGITMPDIR) ++ $(CHMOD) 0755 $(CGITMPDIR) + + for p in master/www/*.tmpl ; do \ + $(INSTALL) -m 0644 "$$p" $(CONFDIR)/templates/ ; \ +diff --git a/Makefile.config b/Makefile.config +index f5557ea..4378b60 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -44,6 +44,9 @@ CGIDIR = $(PREFIX)/www/cgi + # Where to put internal data for master (RRD, internal files, ...) + DBDIR = $(DESTDIR)/var/opt/munin + ++# Where to put CGI cached files (for master only) ++CGITMPDIR = $(DBDIR)/cgi-tmp ++ + # Where to put internal data for node (plugin state, ...) + DBDIRNODE = $(DESTDIR)/var/opt/munin-node + +diff --git a/common/lib/Munin/Common/Defaults.pm b/common/lib/Munin/Common/Defaults.pm +index 131f52c..787b596 100644 +--- a/common/lib/Munin/Common/Defaults.pm ++++ b/common/lib/Munin/Common/Defaults.pm +@@ -25,7 +25,7 @@ our $MUNIN_DOCDIR = ''; + our $MUNIN_LIBDIR = ''; + our $MUNIN_HTMLDIR = ''; + our $MUNIN_CGIDIR = ''; +-our $MUNIN_CGITMPDIR = ''; ++our $MUNIN_CGITMPDIR = ''; + our $MUNIN_DBDIR = ''; + our $MUNIN_PLUGSTATE = ''; + our $MUNIN_SPOOLDIR = ''; +diff --git a/master/_bin/munin-cgi-graph.in b/master/_bin/munin-cgi-graph.in +index 651cf8c..f5a7ccd 100755 +--- a/master/_bin/munin-cgi-graph.in ++++ b/master/_bin/munin-cgi-graph.in +@@ -337,7 +337,7 @@ sub get_picture_filename { + my $params = shift; + + # XXX - hack to fix cgitmpdir default +- $config->{cgitmpdir} ||= "$Munin::Common::Defaults::MUNIN_DBDIR/cgi-tmp"; ++ $config->{cgitmpdir} ||= "$Munin::Common::Defaults::MUNIN_CGITMPDIR"; + my $cgi_tmp_dir = $config->{cgitmpdir} . "/munin-cgi-graph"; + + $params = $params ? "?$params" : ""; +diff --git a/master/lib/Munin/Master/Config.pm b/master/lib/Munin/Master/Config.pm +index 291ffaf..b5c0813 100644 +--- a/master/lib/Munin/Master/Config.pm 2017-03-03 01:02:39.000000000 +0100 ++++ b/master/lib/Munin/Master/Config.pm 2017-07-18 19:29:44.861742592 +0200 +@@ -161,7 +161,7 @@ + tls_verify_depth => 5, + tmpldir => "$Munin::Common::Defaults::MUNIN_CONFDIR/templates", + staticdir => "$Munin::Common::Defaults::MUNIN_CONFDIR/static", +- cgitmpdir => "$Munin::Common::Defaults::MUNIN_DBDIR/cgi-tmp", ++ cgitmpdir => "$Munin::Common::Defaults::MUNIN_CGITMPDIR", + ssh_command => "ssh", + ssh_options => "-o ChallengeResponseAuthentication=no -o StrictHostKeyChecking=no", + }, $class ), +diff --git a/master/munin.conf.in b/master/munin.conf.in +index 8d1a75f..046f369 100644 +--- a/master/munin.conf.in ++++ b/master/munin.conf.in +@@ -21,7 +21,7 @@ + # temporary cgi files are here. note that it has to be writable by + # the cgi user (usually nobody or httpd). + # +-# cgitmpdir @@DBDIR@@/cgi-tmp ++# cgitmpdir @@CGITMPDIR@@ + + # (Exactly one) directory to include all files from. + includedir @@CONFDIR@@/munin-conf.d +-- +2.2.1 + diff --git a/net-analyzer/munin/files/patches/0005-node-use-Net-Domain-hostfqdn-instead-of-Sys-Hostname.patch b/net-analyzer/munin/files/patches/0005-node-use-Net-Domain-hostfqdn-instead-of-Sys-Hostname.patch new file mode 100644 index 000000000000..214cc4c4e6b8 --- /dev/null +++ b/net-analyzer/munin/files/patches/0005-node-use-Net-Domain-hostfqdn-instead-of-Sys-Hostname.patch @@ -0,0 +1,44 @@ +From e504b83d0db596a39f32227d4c473575e227037a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.eu> +Date: Sun, 11 Nov 2012 14:38:16 -0800 +Subject: [PATCH 5/7] node: use Net::Domain::hostfqdn instead of + Sys::Hostname::hostname to get the hostname. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This actually makes the test work correctly, but might change the +returned values for some hosts. + +Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu> +--- + node/lib/Munin/Node/OS.pm | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/node/lib/Munin/Node/OS.pm b/node/lib/Munin/Node/OS.pm +index 31bebac..b8fa58a 100644 +--- a/node/lib/Munin/Node/OS.pm ++++ b/node/lib/Munin/Node/OS.pm +@@ -12,7 +12,7 @@ use Munin::Node::Config; + use Munin::Common::Timeout; + + use POSIX (); +-use Sys::Hostname; ++use Net::Domain qw(hostfqdn); + + sub get_uid { + my ($class, $user) = @_; +@@ -38,9 +38,7 @@ sub _get_xid { + } + + sub get_fq_hostname { +- my $short = Sys::Hostname::hostname(); +- +- return (gethostbyname $short)[0] || $short || "unknown"; ++ return hostfqdn || "unknown"; + } + + sub check_perms_if_paranoid +-- +2.2.1 + diff --git a/net-analyzer/munin/files/patches/0007-node-always-use-the-Effective-UID-not-just-the-UID.patch b/net-analyzer/munin/files/patches/0007-node-always-use-the-Effective-UID-not-just-the-UID.patch new file mode 100644 index 000000000000..07b86e4a9f60 --- /dev/null +++ b/net-analyzer/munin/files/patches/0007-node-always-use-the-Effective-UID-not-just-the-UID.patch @@ -0,0 +1,139 @@ +From 50ca7989a481e31d2434f755812070ac8f4e14c5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.eu> +Date: Sun, 11 Nov 2012 15:18:51 -0800 +Subject: [PATCH 7/7] node: always use the Effective UID not just the UID. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu> +--- + common/lib/Munin/Common/Defaults.pm | 6 +++--- + node/t/munin_node_config.t | 12 ++++++------ + node/t/munin_node_os.t | 6 +++--- + node/t/munin_node_service.t | 14 +++++++------- + 4 files changed, 19 insertions(+), 19 deletions(-) + +diff --git a/common/lib/Munin/Common/Defaults.pm b/common/lib/Munin/Common/Defaults.pm +index 787b596..0f7f292 100644 +--- a/common/lib/Munin/Common/Defaults.pm ++++ b/common/lib/Munin/Common/Defaults.pm +@@ -32,9 +32,9 @@ our $MUNIN_SPOOLDIR = ''; + our $MUNIN_MANDIR = ''; + our $MUNIN_LOGDIR = "$COMPONENT_ROOT/log/"; + our $MUNIN_STATEDIR = ''; +-our $MUNIN_USER = getpwuid $UID; +-our $MUNIN_GROUP = getgrgid $GID; +-our $MUNIN_PLUGINUSER = getpwuid $UID; ++our $MUNIN_USER = getpwuid $EUID; ++our $MUNIN_GROUP = getgrgid $EGID; ++our $MUNIN_PLUGINUSER = getpwuid $EUID; + our $MUNIN_VERSION = 'svn'; + our $MUNIN_PERL = '/usr/bin/perl'; + our $MUNIN_PERLLIB = ''; +diff --git a/node/t/munin_node_config.t b/node/t/munin_node_config.t +index b8b6564..3d5530f 100644 +--- a/node/t/munin_node_config.t ++++ b/node/t/munin_node_config.t +@@ -43,13 +43,13 @@ isa_ok($conf, 'Munin::Node::Config'); + + ### Default user + { +- my $uname = getpwuid $UID; ++ my $uname = getpwuid $EUID; + + my @res = $conf->_parse_line("default_client_user $uname"); +- is_deeply(\@res, [defuser => $UID], 'Parsing default user name'); ++ is_deeply(\@res, [defuser => $EUID], 'Parsing default user name'); + + @res = $conf->_parse_line("default_client_user $UID"); +- is_deeply(\@res, [defuser => $UID], 'Parsing default user ID'); ++ is_deeply(\@res, [defuser => $EUID], 'Parsing default user ID'); + + eval { $conf->_parse_line("default_client_user xxxyyyzzz") }; + like($@, qr{Default user does not exist}, "Default user exists"); +@@ -184,13 +184,13 @@ isa_ok($conf, 'Munin::Node::Config'); + + ### user + { +- my $uname = getpwuid $UID; ++ my $uname = getpwuid $EUID; + + my @res = $conf->_parse_plugin_line("user $uname"); + is_deeply(\@res, [user => $uname], 'Parsing plugin user name'); + +- @res = $conf->_parse_plugin_line("user $UID"); +- is_deeply(\@res, [user => $UID], 'Parsing plugin user ID'); ++ @res = $conf->_parse_plugin_line("user $EUID"); ++ is_deeply(\@res, [user => $EUID], 'Parsing plugin user ID'); + } + + ### group +diff --git a/node/t/munin_node_os.t b/node/t/munin_node_os.t +index 96d7c74..e10d9e6 100644 +--- a/node/t/munin_node_os.t ++++ b/node/t/munin_node_os.t +@@ -13,10 +13,10 @@ my $os = 'Munin::Node::OS'; + + ### get_uid + { +- my $uname = getpwuid $UID; ++ my $uname = getpwuid $EUID; + +- is($os->get_uid($uname), $UID, 'Lookup by user name'); +- is($os->get_uid($UID), $UID, 'Lookup by user ID'); ++ is($os->get_uid($uname), $EUID, 'Lookup by user name'); ++ is($os->get_uid($EUID), $EUID, 'Lookup by user ID'); + + is($os->get_uid('%%SSKK¤¤'), undef, 'Nonexistent user name'); + is($os->get_uid(999999999), undef, 'Nonexistent user ID'); +diff --git a/node/t/munin_node_service.t b/node/t/munin_node_service.t +index 18bda89..7fa050e 100644 +--- a/node/t/munin_node_service.t ++++ b/node/t/munin_node_service.t +@@ -12,8 +12,8 @@ use Munin::Node::Service; + + use English qw(-no_match_vars); + +-my $uname = getpwuid $UID; +-my $gid = (split / /, $GID)[0]; ++my $uname = getpwuid $EUID; ++my $gid = (split / /, $EGID)[0]; + my $gname = getgrgid $gid; + + +@@ -39,7 +39,7 @@ $config->reinitialize({ + + # testing user resolution + uname => { user => $uname }, +- uid => { user => $UID }, ++ uid => { user => $EUID }, + bad_uname => { user => '%%SSKK¤¤' }, + bad_uid => { user => 999999999 }, + +@@ -155,7 +155,7 @@ $ENV{MUNIN_MASTER_IP} = ''; + + ### export_service_environment + { +- my $services = Munin::Node::Service->new(defuser => $UID); ++ my $services = Munin::Node::Service->new(defuser => $EUID); + + $services->export_service_environment('test'); + is($ENV{test_environment_variable}, 'fnord', 'Service-specific environment is exported'); +@@ -164,10 +164,10 @@ $ENV{MUNIN_MASTER_IP} = ''; + + ### _resolve_uid + { +- my $services = Munin::Node::Service->new(defuser => $UID); ++ my $services = Munin::Node::Service->new(defuser => $EUID); + +- is($services->_resolve_uid('uname'), $UID, 'Lookup by service-specific username'); +- is($services->_resolve_uid('uid'), $UID, 'Lookup by service-specific username'); ++ is($services->_resolve_uid('uname'), $EUID, 'Lookup by service-specific username'); ++ is($services->_resolve_uid('uid'), $EUID, 'Lookup by service-specific username'); + + $services->{defuser} = 0; + +-- +2.2.1 + diff --git a/net-analyzer/munin/files/patches/0009-perl-526.patch b/net-analyzer/munin/files/patches/0009-perl-526.patch new file mode 100644 index 000000000000..d3cabb9906c3 --- /dev/null +++ b/net-analyzer/munin/files/patches/0009-perl-526.patch @@ -0,0 +1,26 @@ + + +diff -ruN munin-2.0.33.orig/master/Build.PL munin-2.0.33/master/Build.PL +--- munin-2.0.33.orig/master/Build.PL 2017-03-03 00:02:39.000000000 -0000 ++++ munin-2.0.33/master/Build.PL 2017-08-05 15:06:55.799816839 -0000 +@@ -1,3 +1,4 @@ ++use lib q[.]; + use MasterBuilder; + + use warnings; +diff -ruN munin-2.0.33.orig/node/Build.PL munin-2.0.33/node/Build.PL +--- munin-2.0.33.orig/node/Build.PL 2017-03-03 00:02:39.000000000 -0000 ++++ munin-2.0.33/node/Build.PL 2017-08-05 15:11:07.689824612 -0000 +@@ -1,3 +1,4 @@ ++use lib q[.]; + use NodeBuilder; + + use warnings; +diff -ruN munin-2.0.33.orig/plugins/Build.PL munin-2.0.33/plugins/Build.PL +--- munin-2.0.33.orig/plugins/Build.PL 2017-03-03 00:02:39.000000000 -0000 ++++ munin-2.0.33/plugins/Build.PL 2017-08-05 15:13:57.056168401 -0000 +@@ -1,3 +1,4 @@ ++use lib q[.]; + use PluginsBuilder; + + use warnings; diff --git a/net-analyzer/munin/metadata.xml b/net-analyzer/munin/metadata.xml new file mode 100644 index 000000000000..a9cb2e9c7d27 --- /dev/null +++ b/net-analyzer/munin/metadata.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>sysadmin@gentoo.org</email> + <name>Gentoo Sysadmin Project</name> + </maintainer> + <longdescription lang="en"> + Munin the tool surveys all your computers and remembers what it saw. It + presents all the information in in graphs through a web interface. Its + emphasis is on plug and play capabilities. After completing a installation a + high number of monitoring plugins will be playing with no more effort. Using + Munin you can easily monitor the performance of your computers, networks, + SANs, and quite possibly applications as well. It makes it easy to determine + "what's different today" when a performance problem crops up. It makes it + easy to see how you're doing capacity wise on all limited resources. + </longdescription> + <use> + <flag name="mysql"> + Install the packages required for monitoring MySQL. Disabling + the flag does not remove any plugin files. + </flag> + <flag name="postgres"> + Install the packages required for monitoring + PostgreSQL. Disabling the flag does not remove any plugin files. + </flag> + <flag name="asterisk"> + Install the packages required for monitoring Asterisk. Disabling + the flag does not remove any plugin files. + </flag> + <flag name="irc"> + Install the packages required for monitoring IRC. Disabling the + flag does not remove any plugin files. + </flag> + <flag name="memcached"> + Install the packages required for memcached + monitoring. Disabling the flag does not remove any plugin files. + </flag> + <flag name="ipmi"> + Install <pkg>sys-apps/ipmitool</pkg> required for monitoring + IPMI sensors. Disabling the flag does not remove any plugin + file. + </flag> + <flag name="http"> + Install <pkg>dev-perl/libwww-perl</pkg> required for monitoring + HTTP-based services such as Apache and nginx. Disabling the flag + does not remove any plugin file. + </flag> + <flag name="dhcpd"> + Install <pkg>dev-perl/Net-IP</pkg>, + <pkg>dev-perl/HTTP-Date</pkg> and <pkg>net-misc/dhcp</pkg> to + monitor DHCP lease usage. This only works if the server is on + the same system as the node, so the server is also brought + in. Disabling the flag does not remove any plugin file. + </flag> + <flag name="java"> + Build the Java-based plugins to monitor JMX-compatible + applications. Disabling the flag removes the jmx monitoring + plugins. + </flag> + <flag name="minimal"> + Only install munin-node and its plugins. This excludes the + scripts to generate the web pages and the graphs. + </flag> + <flag name="cgi"> + Install the CGI-compatible scripts for on-the-fly generation of + web pages and graphs. This is only meaningful if the minimal USE + flag is disabled. + </flag> + <flag name="ipv6"> + Add support for IPv6 in munin-node. IPv6 support for the master + is always enabled, but the node requires a newer version of + <pkg>dev-perl/Net-Server</pkg>, capable of listening to IPv6 + sockets. + </flag> + <flag name="syslog"> + Configure the node by default to log on syslog. This requires + the presence of <pkg>virtual/perl-Sys-Syslog</pkg>. As of + version 2.0.2, the master scripts only log to file, and not to + syslog. + </flag> + <flag name="doc"> + Build and install a local copy of the HTML documentation for the + whole software. This requires <pkg>dev-python/sphinx</pkg> to + process the documentation sources. + </flag> + </use> + <upstream> + <remote-id type="cpe">cpe:/a:munin-monitoring:munin</remote-id> + </upstream> + <origin>baldeagleos-repo</origin> +</pkgmetadata> diff --git a/net-analyzer/munin/munin-2.0.75.ebuild b/net-analyzer/munin/munin-2.0.75.ebuild new file mode 100644 index 000000000000..3506945a8431 --- /dev/null +++ b/net-analyzer/munin/munin-2.0.75.ebuild @@ -0,0 +1,417 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PATCHSET=1 + +inherit java-pkg-opt-2 systemd tmpfiles + +MY_P=${P/_/-} + +DESCRIPTION="Munin Server Monitoring Tool" +HOMEPAGE="https://munin-monitoring.org/" +SRC_URI=" + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz + " + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm arm64 ppc ~ppc64 x86" +IUSE="asterisk irc java ldap memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2" +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )" +RESTRICT="!test? ( test )" + +# Upstream's listing of required modules is NOT correct! +# Some of the postgres plugins use DBD::Pg, while others call psql directly. +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly. +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works. +DEPEND_COM=" + acct-user/munin + acct-user/munin-async + acct-group/munin + dev-lang/perl:=[berkdb] + dev-perl/DBI + dev-perl/File-Copy-Recursive + dev-perl/List-MoreUtils + dev-perl/Log-Log4perl + dev-perl/Net-CIDR + dev-perl/Net-DNS + dev-perl/Net-Netmask + dev-perl/Net-SNMP + dev-perl/Net-Server[ipv6(-)?] + dev-perl/TimeDate + virtual/perl-Digest-MD5 + virtual/perl-Getopt-Long + virtual/perl-MIME-Base64 + virtual/perl-Storable + virtual/perl-Text-Balanced + virtual/perl-Time-HiRes + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] ) + asterisk? ( dev-perl/Net-Telnet ) + cgi? ( + dev-perl/FCGI + dev-perl/CGI-Fast + ) + dhcpd? ( + >=net-misc/dhcp-3[server] + dev-perl/Net-IP + dev-perl/HTTP-Date + ) + doc? ( dev-python/sphinx ) + http? ( dev-perl/libwww-perl ) + irc? ( dev-perl/Net-IRC ) + ldap? ( dev-perl/perl-ldap ) + kernel_linux? ( sys-process/procps ) + memcached? ( dev-perl/Cache-Memcached ) + mysql? ( + virtual/mysql + dev-perl/Cache-Cache + dev-perl/DBD-mysql + ) + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* ) + ssl? ( dev-perl/Net-SSLeay ) + syslog? ( virtual/perl-Sys-Syslog ) + !minimal? ( + dev-perl/HTML-Template + dev-perl/IO-Socket-INET6 + dev-perl/URI + >=net-analyzer/rrdtool-1.3[graph,perl] + virtual/ssh + ) + " + +# Keep this seperate, as previous versions have had other deps here +DEPEND="${DEPEND_COM} + dev-perl/Module-Build + java? ( >=virtual/jdk-1.8 ) + test? ( + dev-perl/Test-Deep + dev-perl/Test-Exception + dev-perl/Test-LongString + dev-perl/Test-Differences + dev-perl/Test-MockModule + dev-perl/Test-MockObject + dev-perl/File-Slurp + dev-perl/IO-stringy + dev-perl/IO-Socket-INET6 + )" +RDEPEND="${DEPEND_COM} + app-alternatives/awk + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 ) + java? ( + >=virtual/jre-1.8:* + || ( net-analyzer/netcat net-analyzer/openbsd-netcat ) + ) + !minimal? ( + virtual/cron + media-fonts/dejavu + ) + selinux? ( sec-policy/selinux-munin )" + +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + echo ${PV} > RELEASE || die + + eapply "${FILESDIR}"/patches/*.patch + + eapply_user + + java-pkg-opt-2_src_prepare +} + +src_configure() { + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi' + use cgi || cgidir="${T}/useless/cgi-bin" + + local cgiuser=$(usex apache2 apache munin) + + cat >> "${S}"/Makefile.config <<- EOF || die + PREFIX=\$(DESTDIR)/usr + CONFDIR=\$(DESTDIR)/etc/munin + DOCDIR=${T}/useless/doc + MANDIR=\$(PREFIX)/share/man + LIBDIR=\$(PREFIX)/libexec/munin + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin + CGIDIR=${cgidir} + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi + CGIUSER=${cgiuser} + DBDIR=\$(DESTDIR)/var/lib/munin + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async + LOGDIR=\$(DESTDIR)/var/log/munin + PERLLIB=\$(DESTDIR)$(perl -V:vendorlib | cut -d"'" -f2) + JCVALID=$(usex java yes no) + STATEDIR=\$(DESTDIR)/run/munin + EOF +} + +# parallel make and install need to be fixed before, and I haven't +# gotten around to do so yet. +src_compile() { + emake -j1 + use doc && emake -C doc html +} + +src_test() { + if [[ ${EUID} == 0 ]]; then + eerror "You cannot run tests as root." + eerror "Please enable FEATURES=userpriv before proceeding." + return 1 + fi + + local testtargets="test-common test-node test-plugins" + use minimal || testtargets+=" test-master" + + LC_ALL=C emake -j1 ${testtargets} +} + +src_install() { + local cgiuser=$(usex apache2 apache munin) + + local dirs=" + /var/log/munin + /var/lib/munin/plugin-state + /var/lib/munin-node/plugin-state + /var/www/localhost/htdocs/munin + /etc/munin/plugin-conf.d + /etc/munin/plugins" + use minimal || dirs+=" /etc/munin/munin-conf.d/" + + keepdir ${dirs} + fowners munin:munin ${dirs} + + # parallel install doesn't work and it's also pointless to have this + # run in parallel for now (because it uses internal loops). + emake -j1 CHOWN=true DESTDIR="${D}" $(usex minimal "install-minimal install-man" install) + + # we remove /run and /var/cache from the install, as it's not the + # package's to deal with. + rm -rf "${D}"/run "${D}"/var/cache || die + + # remove the plugins for non-Gentoo package managers; use -f so that + # it doesn't fail when installing on non-Linux platforms. + rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die + + insinto /etc/munin/plugin-conf.d/ + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node + + newinitd "${FILESDIR}"/munin-node_init.d_2.0.73 munin-node + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node + + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd + + newtmpfiles - ${CATEGORY}:${PN}:${SLOT}.conf <<-EOF || die + d /run/munin 0700 munin munin - - + d /var/cache/munin-cgi 0755 ${cgiuser} munin - - + EOF + + systemd_dounit "${FILESDIR}"/munin-async.service + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket} + systemd_dounit "${FILESDIR}"/munin-html.{service,socket} + systemd_dounit "${FILESDIR}"/munin-node.service + + cat >> "${T}"/munin.env <<- EOF + CONFIG_PROTECT=/var/spool/munin-async/.ssh + EOF + newenvd "${T}"/munin.env 50munin + + dodoc README ChangeLog INSTALL + if use doc; then + cd "${S}"/doc/_build/html || die + docinto html + dodoc -r * + cd "${S}" || die + fi + + dodir /etc/logrotate.d/ + sed -e "s:@CGIUSER@:$(usex apache2 apache munin):g" \ + "${FILESDIR}"/logrotate.d-munin.3 > "${D}"/etc/logrotate.d/munin + + dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_ + + if use syslog; then + sed -i -e '/log_file/s| .*| Sys::Syslog|' \ + "${D}"/etc/munin/munin-node.conf || die + fi + + # Use a simpler pid file to avoid trouble with /run in tmpfs. The + # munin-node service is ran as user root, and only later drops + # privileges. + sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \ + "${D}"/etc/munin/munin-node.conf || die + + keepdir /var/spool/munin-async/.ssh + touch "${D}"/var/spool/munin-async/.ssh/authorized_keys + fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}} + fperms 0750 /var/spool/munin-async{,/.ssh} + fperms 0600 /var/spool/munin-async/.ssh/authorized_keys + + if use minimal; then + # This requires the presence of munin-update, which is part of + # the non-minimal install... + rm "${D}"/usr/libexec/munin/plugins/munin_stats + else + # remove font files so that we don't have to keep them around + rm "${D}"/usr/libexec/${PN}/*.ttf || die + + if use cgi; then + sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die + + touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log + fowners $(usex apache2 apache munin) \ + /var/log/munin/munin-cgi-{graph,html}.log + + if use apache2; then + insinto /etc/apache2/vhosts.d + newins "${FILESDIR}"/munin.apache.include-2.4-r1 munin-2.4.include + fi + else + sed \ + -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \ + -i "${D}"/etc/munin/munin.conf || die + fi + + keepdir /var/lib/munin/.ssh + cat >> "${D}"/var/lib/munin/.ssh/config <<- EOF + IdentityFile /var/lib/munin/.ssh/id_ecdsa + IdentityFile /var/lib/munin/.ssh/id_rsa + EOF + + fowners munin:munin /var/lib/munin/.ssh/{,config} + fperms go-rwx /var/lib/munin/.ssh/{,config} + + dodir /usr/share/${PN} + cat >> "${D}"/usr/share/${PN}/crontab <<- EOF + # Force the shell to bash + SHELL=/bin/bash + # Mail reports to root@, not munin@ + MAILTO=root + + # This runs the munin task every 5 minutes. + */5 * * * * /usr/bin/munin-cron + + # Alternatively, this route works differently + # Update once a minute (for busy sites) + #*/1 * * * * /usr/libexec/munin/munin-update + ## Check for limit excess every 2 minutes + #*/2 * * * * /usr/libexec/munin/munin-limits + ## Update graphs every 5 minutes + #*/5 * * * * nice /usr/libexec/munin/munin-graph + ## Update HTML pages every 15 minutes + #*/15 * * * * nice /usr/libexec/munin/munin-html + EOF + + cat >> "${D}"/usr/share/${PN}/fcrontab <<- EOF + # Mail reports to root@, not munin@, only execute one at a time + !mailto(root),serial(true) + + # This runs the munin task every 5 minutes. + @ 5 /usr/bin/munin-cron + + # Alternatively, this route works differently + # Update once a minute (for busy sites) + #@ 1 /usr/libexec/munin/munin-update + ## Check for limit excess every 2 minutes + #@ 2 /usr/libexec/munin/munin-limits + ## Update graphs every 5 minutes + #@ 5 nice /usr/libexec/munin/munin-graph + ## Update HTML pages every 15 minutes + #@ 15 nice /usr/libexec/munin/munin-html + EOF + + # remove .htaccess file + find "${D}" -name .htaccess -delete || die + fi +} + +pkg_config() { + if use minimal; then + einfo "Nothing to do." + return 0 + fi + + einfo "Press enter to install the default crontab for the munin master" + einfo "installation from /usr/share/${PN}/f?crontab" + einfo "If you have a large site, you may wish to customize it." + read + + ebegin "Setting up cron ..." + if has_version sys-process/fcron; then + fcrontab - -u munin < /usr/share/${PN}/fcrontab + else + # dcron is very fussy about syntax + # the following is the only form that works in BOTH dcron and vixie-cron + crontab - -u munin < /usr/share/${PN}/crontab + fi + eend $? + + einfo "Press enter to set up the SSH keys used for SSH transport" + read + + # generate one rsa (for legacy) and one ecdsa (for new systems) + ssh-keygen -t rsa \ + -f /var/lib/munin/.ssh/id_rsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + ssh-keygen -t ecdsa \ + -f /var/lib/munin/.ssh/id_ecdsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + chown -R munin:munin /var/lib/munin/.ssh || die + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die + + einfo "Your public keys are available in " + einfo " /var/lib/munin/.ssh/id_rsa.pub" + einfo " /var/lib/munin/.ssh/id_ecdsa.pub" + einfo "and follows for convenience" + echo + cat /var/lib/munin/.ssh/id_*.pub +} + +pkg_postinst() { + tmpfiles_process ${CATEGORY}:${PN}:${SLOT}.conf + + elog "Please follow the munin documentation to set up the plugins you" + elog "need, afterwards start munin-node." + elog "" + elog "To make use of munin-async, make sure to set up the corresponding" + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys" + elog "" + if ! use minimal; then + elog "Please run" + elog " emerge --config net-analyzer/munin" + elog "to automatically configure munin's cronjobs as well as generate" + elog "passwordless SSH keys to be used with munin-async." + fi + elog "" + elog "Further information about setting up Munin in Gentoo can be found" + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin" + + if use cgi; then + chown $(usex apache2 apache munin) \ + "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log + + if use apache2; then + elog "To use Munin with CGI you should include" + elog "/etc/apache2/vhosts.d/munin-2.4.include from the virtual" + elog "host you want it to be served." + elog "If you want to enable CGI-based HTML as well, you have to add to" + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI." + else + elog "Effective CGI support has just been added in 2.0.7-r6." + elog "Documentation on how to use it is still sparse." + fi + fi + + # we create this here as we don't want Portage to check /run + # symlinks but we still need this to be present before the reboot. + if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then + mkdir "${ROOT}"/run/munin + chown munin:munin "${ROOT}"/run/munin + chmod 0700 "${ROOT}"/run/munin + fi +} diff --git a/net-analyzer/munin/munin-2.0.76-r2.ebuild b/net-analyzer/munin/munin-2.0.76-r2.ebuild new file mode 100644 index 000000000000..3d4f08b69bb1 --- /dev/null +++ b/net-analyzer/munin/munin-2.0.76-r2.ebuild @@ -0,0 +1,418 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PATCHSET=1 + +inherit java-pkg-opt-2 systemd tmpfiles + +MY_P=${P/_/-} + +DESCRIPTION="Munin Server Monitoring Tool" +HOMEPAGE="https://munin-monitoring.org/" +SRC_URI=" + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz + " + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm arm64 ppc ~ppc64 x86" +IUSE="asterisk irc java ldap memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2" +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )" +RESTRICT="!test? ( test )" + +# Upstream's listing of required modules is NOT correct! +# Some of the postgres plugins use DBD::Pg, while others call psql directly. +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly. +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works. +DEPEND_COM=" + acct-user/munin + acct-user/munin-async + acct-group/munin + dev-lang/perl:=[berkdb] + dev-perl/DBI + dev-perl/File-Copy-Recursive + dev-perl/List-MoreUtils + dev-perl/Log-Log4perl + dev-perl/Net-CIDR + dev-perl/Net-DNS + dev-perl/Net-Netmask + dev-perl/Net-SNMP + dev-perl/Net-Server[ipv6(-)?] + dev-perl/TimeDate + virtual/perl-Digest-MD5 + virtual/perl-Getopt-Long + virtual/perl-MIME-Base64 + virtual/perl-Storable + virtual/perl-Text-Balanced + virtual/perl-Time-HiRes + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] ) + asterisk? ( dev-perl/Net-Telnet ) + cgi? ( + dev-perl/FCGI + dev-perl/CGI-Fast + ) + dhcpd? ( + >=net-misc/dhcp-3[server] + dev-perl/Net-IP + dev-perl/HTTP-Date + ) + doc? ( dev-python/sphinx ) + http? ( dev-perl/libwww-perl ) + irc? ( dev-perl/Net-IRC ) + ldap? ( dev-perl/perl-ldap ) + kernel_linux? ( sys-process/procps ) + memcached? ( dev-perl/Cache-Memcached ) + mysql? ( + virtual/mysql + dev-perl/Cache-Cache + dev-perl/DBD-mysql + ) + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* ) + ssl? ( dev-perl/Net-SSLeay ) + syslog? ( virtual/perl-Sys-Syslog ) + !minimal? ( + dev-perl/HTML-Template + dev-perl/IO-Socket-INET6 + dev-perl/URI + >=net-analyzer/rrdtool-1.3[graph,perl] + virtual/ssh + ) + " + +# Keep this seperate, as previous versions have had other deps here +DEPEND="${DEPEND_COM} + dev-perl/Module-Build + java? ( >=virtual/jdk-1.8 ) + test? ( + dev-perl/Test-Deep + dev-perl/Test-Exception + dev-perl/Test-LongString + dev-perl/Test-Differences + dev-perl/Test-MockModule + dev-perl/Test-MockObject + dev-perl/File-Slurp + dev-perl/IO-stringy + dev-perl/IO-Socket-INET6 + )" +RDEPEND="${DEPEND_COM} + app-alternatives/awk + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 ) + java? ( + >=virtual/jre-1.8:* + || ( net-analyzer/netcat net-analyzer/openbsd-netcat ) + ) + !minimal? ( + virtual/cron + media-fonts/dejavu + ) + selinux? ( sec-policy/selinux-munin )" + +S="${WORKDIR}/${MY_P}" + +pkg_setup() { + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + echo ${PV} > RELEASE || die + + eapply "${FILESDIR}"/patches/*.patch + + eapply_user + + java-pkg-opt-2_src_prepare +} + +src_configure() { + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi' + use cgi || cgidir="${T}/useless/cgi-bin" + + local cgiuser=$(usex apache2 apache munin) + + cat >> "${S}"/Makefile.config <<- EOF || die + PREFIX=\$(DESTDIR)/usr + CONFDIR=\$(DESTDIR)/etc/munin + DOCDIR=${T}/useless/doc + MANDIR=\$(PREFIX)/share/man + LIBDIR=\$(PREFIX)/libexec/munin + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin + CGIDIR=${cgidir} + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi + CGIUSER=${cgiuser} + DBDIR=\$(DESTDIR)/var/lib/munin + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async + LOGDIR=\$(DESTDIR)/var/log/munin + PERLLIB=\$(DESTDIR)$(perl -V:vendorlib | cut -d"'" -f2) + JCVALID=$(usex java yes no) + JFLAGS=-Xlint + STATEDIR=\$(DESTDIR)/run/munin + EOF +} + +# parallel make and install need to be fixed before, and I haven't +# gotten around to do so yet. +src_compile() { + emake -j1 + use doc && emake -C doc html +} + +src_test() { + if [[ ${EUID} == 0 ]]; then + eerror "You cannot run tests as root." + eerror "Please enable FEATURES=userpriv before proceeding." + return 1 + fi + + local testtargets="test-common test-node test-plugins" + use minimal || testtargets+=" test-master" + + LC_ALL=C emake -j1 ${testtargets} +} + +src_install() { + local cgiuser=$(usex apache2 apache munin) + + local dirs=" + /var/log/munin + /var/lib/munin/plugin-state + /var/lib/munin-node/plugin-state + /var/www/localhost/htdocs/munin + /etc/munin/plugin-conf.d + /etc/munin/plugins" + use minimal || dirs+=" /etc/munin/munin-conf.d/" + + keepdir ${dirs} + fowners munin:munin ${dirs} + + # parallel install doesn't work and it's also pointless to have this + # run in parallel for now (because it uses internal loops). + emake -j1 CHOWN=true DESTDIR="${D}" $(usex minimal "install-minimal install-man" install) + + # we remove /run and /var/cache from the install, as it's not the + # package's to deal with. + rm -rf "${D}"/run "${D}"/var/cache || die + + # remove the plugins for non-Gentoo package managers; use -f so that + # it doesn't fail when installing on non-Linux platforms. + rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die + + insinto /etc/munin/plugin-conf.d/ + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node + + newinitd "${FILESDIR}"/munin-node_init.d_2.0.73 munin-node + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node + + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd + + newtmpfiles - ${CATEGORY}:${PN}:${SLOT}.conf <<-EOF || die + d /run/munin 0700 munin munin - - + d /var/cache/munin-cgi 0755 ${cgiuser} munin - - + EOF + + systemd_dounit "${FILESDIR}"/munin-async.service + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket} + systemd_dounit "${FILESDIR}"/munin-html.{service,socket} + systemd_dounit "${FILESDIR}"/munin-node.service + + cat >> "${T}"/munin.env <<- EOF + CONFIG_PROTECT=/var/spool/munin-async/.ssh + EOF + newenvd "${T}"/munin.env 50munin + + dodoc README ChangeLog INSTALL + if use doc; then + cd "${S}"/doc/_build/html || die + docinto html + dodoc -r * + cd "${S}" || die + fi + + dodir /etc/logrotate.d/ + sed -e "s:@CGIUSER@:$(usex apache2 apache munin):g" \ + "${FILESDIR}"/logrotate.d-munin.4 > "${D}"/etc/logrotate.d/munin + + dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_ + + if use syslog; then + sed -i -e '/log_file/s| .*| Sys::Syslog|' \ + "${D}"/etc/munin/munin-node.conf || die + fi + + # Use a simpler pid file to avoid trouble with /run in tmpfs. The + # munin-node service is ran as user root, and only later drops + # privileges. + sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \ + "${D}"/etc/munin/munin-node.conf || die + + keepdir /var/spool/munin-async/.ssh + touch "${D}"/var/spool/munin-async/.ssh/authorized_keys + fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}} + fperms 0750 /var/spool/munin-async{,/.ssh} + fperms 0600 /var/spool/munin-async/.ssh/authorized_keys + + if use minimal; then + # This requires the presence of munin-update, which is part of + # the non-minimal install... + rm "${D}"/usr/libexec/munin/plugins/munin_stats + else + # remove font files so that we don't have to keep them around + rm "${D}"/usr/libexec/${PN}/*.ttf || die + + if use cgi; then + sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die + + touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log + fowners $(usex apache2 apache munin) \ + /var/log/munin/munin-cgi-{graph,html}.log + + if use apache2; then + insinto /etc/apache2/vhosts.d + newins "${FILESDIR}"/munin.apache.include-2.4-r1 munin-2.4.include + fi + else + sed \ + -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \ + -i "${D}"/etc/munin/munin.conf || die + fi + + keepdir /var/lib/munin/.ssh + cat >> "${D}"/var/lib/munin/.ssh/config <<- EOF + IdentityFile /var/lib/munin/.ssh/id_ecdsa + IdentityFile /var/lib/munin/.ssh/id_rsa + EOF + + fowners munin:munin /var/lib/munin/.ssh/{,config} + fperms go-rwx /var/lib/munin/.ssh/{,config} + + dodir /usr/share/${PN} + cat >> "${D}"/usr/share/${PN}/crontab <<- EOF + # Force the shell to bash + SHELL=/bin/bash + # Mail reports to root@, not munin@ + MAILTO=root + + # This runs the munin task every 5 minutes. + */5 * * * * /usr/bin/munin-cron + + # Alternatively, this route works differently + # Update once a minute (for busy sites) + #*/1 * * * * /usr/libexec/munin/munin-update + ## Check for limit excess every 2 minutes + #*/2 * * * * /usr/libexec/munin/munin-limits + ## Update graphs every 5 minutes + #*/5 * * * * nice /usr/libexec/munin/munin-graph + ## Update HTML pages every 15 minutes + #*/15 * * * * nice /usr/libexec/munin/munin-html + EOF + + cat >> "${D}"/usr/share/${PN}/fcrontab <<- EOF + # Mail reports to root@, not munin@, only execute one at a time + !mailto(root),serial(true) + + # This runs the munin task every 5 minutes. + @ 5 /usr/bin/munin-cron + + # Alternatively, this route works differently + # Update once a minute (for busy sites) + #@ 1 /usr/libexec/munin/munin-update + ## Check for limit excess every 2 minutes + #@ 2 /usr/libexec/munin/munin-limits + ## Update graphs every 5 minutes + #@ 5 nice /usr/libexec/munin/munin-graph + ## Update HTML pages every 15 minutes + #@ 15 nice /usr/libexec/munin/munin-html + EOF + + # remove .htaccess file + find "${D}" -name .htaccess -delete || die + fi +} + +pkg_config() { + if use minimal; then + einfo "Nothing to do." + return 0 + fi + + einfo "Press enter to install the default crontab for the munin master" + einfo "installation from /usr/share/${PN}/f?crontab" + einfo "If you have a large site, you may wish to customize it." + read + + ebegin "Setting up cron ..." + if has_version sys-process/fcron; then + fcrontab - -u munin < /usr/share/${PN}/fcrontab + else + # dcron is very fussy about syntax + # the following is the only form that works in BOTH dcron and vixie-cron + crontab - -u munin < /usr/share/${PN}/crontab + fi + eend $? + + einfo "Press enter to set up the SSH keys used for SSH transport" + read + + # generate one rsa (for legacy) and one ecdsa (for new systems) + ssh-keygen -t rsa \ + -f /var/lib/munin/.ssh/id_rsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + ssh-keygen -t ecdsa \ + -f /var/lib/munin/.ssh/id_ecdsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + chown -R munin:munin /var/lib/munin/.ssh || die + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die + + einfo "Your public keys are available in " + einfo " /var/lib/munin/.ssh/id_rsa.pub" + einfo " /var/lib/munin/.ssh/id_ecdsa.pub" + einfo "and follows for convenience" + echo + cat /var/lib/munin/.ssh/id_*.pub +} + +pkg_postinst() { + tmpfiles_process ${CATEGORY}:${PN}:${SLOT}.conf + + elog "Please follow the munin documentation to set up the plugins you" + elog "need, afterwards start munin-node." + elog "" + elog "To make use of munin-async, make sure to set up the corresponding" + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys" + elog "" + if ! use minimal; then + elog "Please run" + elog " emerge --config net-analyzer/munin" + elog "to automatically configure munin's cronjobs as well as generate" + elog "passwordless SSH keys to be used with munin-async." + fi + elog "" + elog "Further information about setting up Munin in Gentoo can be found" + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin" + + if use cgi; then + chown $(usex apache2 apache munin) \ + "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log + + if use apache2; then + elog "To use Munin with CGI you should include" + elog "/etc/apache2/vhosts.d/munin-2.4.include from the virtual" + elog "host you want it to be served." + elog "If you want to enable CGI-based HTML as well, you have to add to" + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI." + else + elog "Effective CGI support has just been added in 2.0.7-r6." + elog "Documentation on how to use it is still sparse." + fi + fi + + # we create this here as we don't want Portage to check /run + # symlinks but we still need this to be present before the reboot. + if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then + mkdir "${ROOT}"/run/munin + chown munin:munin "${ROOT}"/run/munin + chmod 0700 "${ROOT}"/run/munin + fi +} diff --git a/net-analyzer/munin/munin-2.0.76-r3.ebuild b/net-analyzer/munin/munin-2.0.76-r3.ebuild new file mode 100644 index 000000000000..fcef4b96122f --- /dev/null +++ b/net-analyzer/munin/munin-2.0.76-r3.ebuild @@ -0,0 +1,418 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PATCHSET=1 + +inherit java-pkg-opt-2 systemd tmpfiles + +MY_P=${P/_/-} + +DESCRIPTION="Munin Server Monitoring Tool" +HOMEPAGE="https://munin-monitoring.org/" +SRC_URI=" + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz + " + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm arm64 ppc ~ppc64 x86" +IUSE="asterisk irc java ldap memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2" +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )" + +# Upstream's listing of required modules is NOT correct! +# Some of the postgres plugins use DBD::Pg, while others call psql directly. +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly. +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works. +DEPEND_COM=" + acct-user/munin + acct-user/munin-async + acct-group/munin + dev-lang/perl:=[berkdb] + dev-perl/DBI + dev-perl/File-Copy-Recursive + dev-perl/List-MoreUtils + dev-perl/Log-Log4perl + dev-perl/Net-CIDR + dev-perl/Net-DNS + dev-perl/Net-Netmask + dev-perl/Net-SNMP + dev-perl/Net-Server[ipv6(-)?] + dev-perl/TimeDate + virtual/perl-Digest-MD5 + virtual/perl-Getopt-Long + virtual/perl-MIME-Base64 + virtual/perl-Storable + virtual/perl-Text-Balanced + virtual/perl-Time-HiRes + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] ) + asterisk? ( dev-perl/Net-Telnet ) + cgi? ( + dev-perl/FCGI + dev-perl/CGI-Fast + ) + dhcpd? ( + >=net-misc/dhcp-3[server] + dev-perl/Net-IP + dev-perl/HTTP-Date + ) + doc? ( dev-python/sphinx ) + http? ( dev-perl/libwww-perl ) + irc? ( dev-perl/Net-IRC ) + ldap? ( dev-perl/perl-ldap ) + kernel_linux? ( sys-process/procps ) + memcached? ( dev-perl/Cache-Memcached ) + mysql? ( + virtual/mysql + dev-perl/Cache-Cache + dev-perl/DBD-mysql + ) + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* ) + ssl? ( dev-perl/Net-SSLeay ) + syslog? ( virtual/perl-Sys-Syslog ) + !minimal? ( + dev-perl/HTML-Template + dev-perl/IO-Socket-INET6 + dev-perl/URI + >=net-analyzer/rrdtool-1.3[graph,perl] + virtual/ssh + ) + " + +# Keep this seperate, as previous versions have had other deps here +DEPEND="${DEPEND_COM} + dev-perl/Module-Build + java? ( >=virtual/jdk-1.8 ) + test? ( + dev-perl/Test-Deep + dev-perl/Test-Exception + dev-perl/Test-LongString + dev-perl/Test-Differences + dev-perl/Test-MockModule + dev-perl/Test-MockObject + dev-perl/File-Slurp + dev-perl/IO-stringy + dev-perl/IO-Socket-INET6 + )" +RDEPEND="${DEPEND_COM} + app-alternatives/awk + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 ) + java? ( + >=virtual/jre-1.8:* + || ( net-analyzer/netcat net-analyzer/openbsd-netcat ) + ) + !minimal? ( + virtual/cron + media-fonts/dejavu + ) + selinux? ( sec-policy/selinux-munin )" + +S="${WORKDIR}/${MY_P}" +RESTRICT="!test? ( test )" + +pkg_setup() { + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + echo ${PV} > RELEASE || die + + eapply "${FILESDIR}"/patches/*.patch + + eapply_user + + java-pkg-opt-2_src_prepare +} + +src_configure() { + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi' + use cgi || cgidir="${T}/useless/cgi-bin" + + local cgiuser=$(usex apache2 apache munin) + + cat >> "${S}"/Makefile.config <<- EOF || die + PREFIX=\$(DESTDIR)/usr + CONFDIR=\$(DESTDIR)/etc/munin + DOCDIR=${T}/useless/doc + MANDIR=\$(PREFIX)/share/man + LIBDIR=\$(PREFIX)/libexec/munin + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin + CGIDIR=${cgidir} + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi + CGIUSER=${cgiuser} + DBDIR=\$(DESTDIR)/var/lib/munin + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async + LOGDIR=\$(DESTDIR)/var/log/munin + PERLLIB=\$(DESTDIR)$(perl -V:vendorlib | cut -d"'" -f2) + JCVALID=$(usex java yes no) + JFLAGS=-Xlint + STATEDIR=\$(DESTDIR)/run/munin + EOF +} + +# parallel make and install need to be fixed before, and I haven't +# gotten around to do so yet. +src_compile() { + emake -j1 + use doc && emake -C doc html +} + +src_test() { + if [[ ${EUID} == 0 ]]; then + eerror "You cannot run tests as root." + eerror "Please enable FEATURES=userpriv before proceeding." + return 1 + fi + + local testtargets="test-common test-node test-plugins" + use minimal || testtargets+=" test-master" + + LC_ALL=C emake -j1 ${testtargets} +} + +src_install() { + local cgiuser=$(usex apache2 apache munin) + + local dirs=" + /var/log/munin + /var/lib/munin/plugin-state + /var/lib/munin-node/plugin-state + /var/www/localhost/htdocs/munin + /etc/munin/plugin-conf.d + /etc/munin/plugins" + use minimal || dirs+=" /etc/munin/munin-conf.d/" + + keepdir ${dirs} + fowners munin:munin ${dirs} + + # parallel install doesn't work and it's also pointless to have this + # run in parallel for now (because it uses internal loops). + emake -j1 CHOWN=true DESTDIR="${D}" $(usex minimal "install-minimal install-man" install) + + # we remove /run and /var/cache from the install, as it's not the + # package's to deal with. + rm -rf "${D}"/run "${D}"/var/cache || die + + # remove the plugins for non-Gentoo package managers; use -f so that + # it doesn't fail when installing on non-Linux platforms. + rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die + + insinto /etc/munin/plugin-conf.d/ + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node + + newinitd "${FILESDIR}"/munin-node_init.d_2.0.73 munin-node + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node + + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd + + newtmpfiles - ${CATEGORY}:${PN}:${SLOT}.conf <<-EOF || die + d /run/munin 0700 munin munin - - + d /var/cache/munin-cgi 0755 ${cgiuser} munin - - + EOF + + systemd_dounit "${FILESDIR}"/munin-async.service + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket} + systemd_dounit "${FILESDIR}"/munin-html.{service,socket} + systemd_dounit "${FILESDIR}"/munin-node.service + + cat >> "${T}"/munin.env <<- EOF + CONFIG_PROTECT=/var/spool/munin-async/.ssh + EOF + newenvd "${T}"/munin.env 50munin + + dodoc README ChangeLog INSTALL + if use doc; then + cd "${S}"/doc/_build/html || die + docinto html + dodoc -r * + cd "${S}" || die + fi + + dodir /etc/logrotate.d/ + sed -e "s:@CGIUSER@:$(usex apache2 apache munin):g" \ + "${FILESDIR}"/logrotate.d-munin.5 > "${D}"/etc/logrotate.d/munin + + dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_ + + if use syslog; then + sed -i -e '/log_file/s| .*| Sys::Syslog|' \ + "${D}"/etc/munin/munin-node.conf || die + fi + + # Use a simpler pid file to avoid trouble with /run in tmpfs. The + # munin-node service is ran as user root, and only later drops + # privileges. + sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \ + "${D}"/etc/munin/munin-node.conf || die + + keepdir /var/spool/munin-async/.ssh + touch "${D}"/var/spool/munin-async/.ssh/authorized_keys + fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}} + fperms 0750 /var/spool/munin-async{,/.ssh} + fperms 0600 /var/spool/munin-async/.ssh/authorized_keys + + if use minimal; then + # This requires the presence of munin-update, which is part of + # the non-minimal install... + rm "${D}"/usr/libexec/munin/plugins/munin_stats + else + # remove font files so that we don't have to keep them around + rm "${D}"/usr/libexec/${PN}/*.ttf || die + + if use cgi; then + sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die + + touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log + fowners $(usex apache2 apache munin) \ + /var/log/munin/munin-cgi-{graph,html}.log + + if use apache2; then + insinto /etc/apache2/vhosts.d + newins "${FILESDIR}"/munin.apache.include-2.4-r1 munin-2.4.include + fi + else + sed \ + -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \ + -i "${D}"/etc/munin/munin.conf || die + fi + + keepdir /var/lib/munin/.ssh + cat >> "${D}"/var/lib/munin/.ssh/config <<- EOF + IdentityFile /var/lib/munin/.ssh/id_ecdsa + IdentityFile /var/lib/munin/.ssh/id_rsa + EOF + + fowners munin:munin /var/lib/munin/.ssh/{,config} + fperms go-rwx /var/lib/munin/.ssh/{,config} + + dodir /usr/share/${PN} + cat >> "${D}"/usr/share/${PN}/crontab <<- EOF + # Force the shell to bash + SHELL=/bin/bash + # Mail reports to root@, not munin@ + MAILTO=root + + # This runs the munin task every 5 minutes. + */5 * * * * /usr/bin/munin-cron + + # Alternatively, this route works differently + # Update once a minute (for busy sites) + #*/1 * * * * /usr/libexec/munin/munin-update + ## Check for limit excess every 2 minutes + #*/2 * * * * /usr/libexec/munin/munin-limits + ## Update graphs every 5 minutes + #*/5 * * * * nice /usr/libexec/munin/munin-graph + ## Update HTML pages every 15 minutes + #*/15 * * * * nice /usr/libexec/munin/munin-html + EOF + + cat >> "${D}"/usr/share/${PN}/fcrontab <<- EOF + # Mail reports to root@, not munin@, only execute one at a time + !mailto(root),serial(true) + + # This runs the munin task every 5 minutes. + @ 5 /usr/bin/munin-cron + + # Alternatively, this route works differently + # Update once a minute (for busy sites) + #@ 1 /usr/libexec/munin/munin-update + ## Check for limit excess every 2 minutes + #@ 2 /usr/libexec/munin/munin-limits + ## Update graphs every 5 minutes + #@ 5 nice /usr/libexec/munin/munin-graph + ## Update HTML pages every 15 minutes + #@ 15 nice /usr/libexec/munin/munin-html + EOF + + # remove .htaccess file + find "${D}" -name .htaccess -delete || die + fi +} + +pkg_config() { + if use minimal; then + einfo "Nothing to do." + return 0 + fi + + einfo "Press enter to install the default crontab for the munin master" + einfo "installation from /usr/share/${PN}/f?crontab" + einfo "If you have a large site, you may wish to customize it." + read + + ebegin "Setting up cron ..." + if has_version sys-process/fcron; then + fcrontab - -u munin < /usr/share/${PN}/fcrontab + else + # dcron is very fussy about syntax + # the following is the only form that works in BOTH dcron and vixie-cron + crontab - -u munin < /usr/share/${PN}/crontab + fi + eend $? + + einfo "Press enter to set up the SSH keys used for SSH transport" + read + + # generate one rsa (for legacy) and one ecdsa (for new systems) + ssh-keygen -t rsa \ + -f /var/lib/munin/.ssh/id_rsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + ssh-keygen -t ecdsa \ + -f /var/lib/munin/.ssh/id_ecdsa -N '' \ + -C "created by portage for ${CATEGORY}/${PN}" || die + chown -R munin:munin /var/lib/munin/.ssh || die + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die + + einfo "Your public keys are available in " + einfo " /var/lib/munin/.ssh/id_rsa.pub" + einfo " /var/lib/munin/.ssh/id_ecdsa.pub" + einfo "and follows for convenience" + echo + cat /var/lib/munin/.ssh/id_*.pub +} + +pkg_postinst() { + tmpfiles_process ${CATEGORY}:${PN}:${SLOT}.conf + + elog "Please follow the munin documentation to set up the plugins you" + elog "need, afterwards start munin-node." + elog "" + elog "To make use of munin-async, make sure to set up the corresponding" + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys" + elog "" + if ! use minimal; then + elog "Please run" + elog " emerge --config net-analyzer/munin" + elog "to automatically configure munin's cronjobs as well as generate" + elog "passwordless SSH keys to be used with munin-async." + fi + elog "" + elog "Further information about setting up Munin in Gentoo can be found" + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin" + + if use cgi; then + chown $(usex apache2 apache munin) \ + "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log + + if use apache2; then + elog "To use Munin with CGI you should include" + elog "/etc/apache2/vhosts.d/munin-2.4.include from the virtual" + elog "host you want it to be served." + elog "If you want to enable CGI-based HTML as well, you have to add to" + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI." + else + elog "Effective CGI support has just been added in 2.0.7-r6." + elog "Documentation on how to use it is still sparse." + fi + fi + + # we create this here as we don't want Portage to check /run + # symlinks but we still need this to be present before the reboot. + if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then + mkdir "${ROOT}"/run/munin + chown munin:munin "${ROOT}"/run/munin + chmod 0700 "${ROOT}"/run/munin + fi +} |
