Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/monitoring-plugins/, net-analyzer/monitoring-plugins/files/
Date: Tue, 01 Feb 2022 08:17:19
Message-Id: 1643703427.c9fa9976a7c5fed79242dd70b2b46b1e07da0152.juippis@gentoo
1 commit: c9fa9976a7c5fed79242dd70b2b46b1e07da0152
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Sat Jan 8 14:05:43 2022 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 1 08:17:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9fa9976
7
8 net-analyzer/monitoring-plugins: fix check_disk on btrfs
9
10 Closes: https://bugs.gentoo.org/830249
11 Reported-by: satmd <AT> satmd.de
12 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
13 Closes: https://github.com/gentoo/gentoo/pull/23700
14 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
15
16 ...onitoring-plugins-fix-check-disk-on-btrfs.patch | 20 ++++
17 .../monitoring-plugins-2.3.1-r1.ebuild | 108 +++++++++++++++++++++
18 2 files changed, 128 insertions(+)
19
20 diff --git a/net-analyzer/monitoring-plugins/files/monitoring-plugins-fix-check-disk-on-btrfs.patch b/net-analyzer/monitoring-plugins/files/monitoring-plugins-fix-check-disk-on-btrfs.patch
21 new file mode 100644
22 index 000000000000..cbd458372133
23 --- /dev/null
24 +++ b/net-analyzer/monitoring-plugins/files/monitoring-plugins-fix-check-disk-on-btrfs.patch
25 @@ -0,0 +1,20 @@
26 +https://bugs.gentoo.org/830249
27 +https://github.com/monitoring-plugins/monitoring-plugins/issues/1357
28 +https://github.com/monitoring-plugins/monitoring-plugins/commit/e17c1e9ed95b8b9681dccd5a909ac5a02a04416c
29 +
30 +diff --git a/plugins/check_disk.c b/plugins/check_disk.c
31 +index 844e625f..a2735195 100644
32 +--- a/plugins/check_disk.c
33 ++++ b/plugins/check_disk.c
34 +@@ -1068,10 +1068,7 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) {
35 +
36 + void
37 + get_path_stats (struct parameter_list *p, struct fs_usage *fsp) {
38 +- /* 2007-12-08 - Workaround for Gnulib reporting insanely high available
39 +- * space on BSD (the actual value should be negative but fsp->fsu_bavail
40 +- * is unsigned) */
41 +- p->available = fsp->fsu_bavail > fsp->fsu_bfree ? 0 : fsp->fsu_bavail;
42 ++ p->available = fsp->fsu_bavail;
43 + p->available_to_root = fsp->fsu_bfree;
44 + p->used = fsp->fsu_blocks - fsp->fsu_bfree;
45 + if (freespace_ignore_reserved) {
46
47 diff --git a/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.1-r1.ebuild b/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.1-r1.ebuild
48 new file mode 100644
49 index 000000000000..9c951f0457cf
50 --- /dev/null
51 +++ b/net-analyzer/monitoring-plugins/monitoring-plugins-2.3.1-r1.ebuild
52 @@ -0,0 +1,108 @@
53 +# Copyright 1999-2022 Gentoo Authors
54 +# Distributed under the terms of the GNU General Public License v2
55 +
56 +EAPI="8"
57 +
58 +inherit flag-o-matic
59 +
60 +DESCRIPTION="50+ standard plugins for Icinga, Naemon, Nagios, Shinken, Sensu"
61 +HOMEPAGE="https://www.monitoring-plugins.org/"
62 +SRC_URI="https://www.monitoring-plugins.org/download/${P}.tar.gz"
63 +
64 +LICENSE="GPL-3"
65 +SLOT="0"
66 +KEYWORDS="~amd64 ~arm ~arm64 ~sparc ~x86"
67 +IUSE="curl gnutls ipv6 ldap mysql dns fping game postgres radius samba snmp ssh +ssl"
68 +
69 +# Most of the plugins use automagic dependencies, i.e. the plugin will
70 +# get built if the binary it uses is installed. For example, check_snmp
71 +# will be built only if snmpget from net-analyzer/net-snmp[-minimal] is
72 +# installed. End result: most of our runtime dependencies are required
73 +# at build time as well.
74 +#
75 +# REAL_DEPEND contains the dependencies that are actually needed to
76 +# build. DEPEND contains those plus the automagic dependencies.
77 +#
78 +REAL_DEPEND="dev-lang/perl
79 + curl? (
80 + dev-libs/uriparser
81 + net-misc/curl
82 + )
83 + ldap? ( net-nds/openldap )
84 + mysql? ( || ( dev-db/mysql-connector-c dev-db/mariadb-connector-c ) )
85 + postgres? ( dev-db/postgresql:= )
86 + ssl? (
87 + !gnutls? (
88 + dev-libs/openssl:0=
89 + )
90 + gnutls? ( net-libs/gnutls )
91 + )
92 + radius? ( net-dialup/freeradius-client )"
93 +
94 +DEPEND="${REAL_DEPEND}
95 + dns? ( net-dns/bind-tools )
96 + game? ( games-util/qstat )
97 + fping? ( net-analyzer/fping )
98 + samba? ( net-fs/samba )
99 + ssh? ( net-misc/openssh )
100 + snmp? ( dev-perl/Net-SNMP
101 + net-analyzer/net-snmp[-minimal] )"
102 +
103 +# Basically everything collides with nagios-plugins.
104 +RDEPEND="${DEPEND}
105 + acct-group/nagios
106 + acct-user/nagios
107 + !net-analyzer/nagios-plugins"
108 +
109 +# At least one test is interactive.
110 +RESTRICT="test"
111 +
112 +PATCHES=(
113 + "${FILESDIR}/${PN}-fix-check-disk-on-btrfs.patch" #830249
114 +)
115 +
116 +src_configure() {
117 + append-flags -fno-strict-aliasing
118 +
119 + # Use an array to prevent econf from mangling the ping args.
120 + local myconf=()
121 +
122 + if use ssl; then
123 + myconf+=( $(use_with !gnutls openssl /usr)
124 + $(use_with gnutls gnutls /usr) )
125 + else
126 + myconf+=( --without-openssl )
127 + myconf+=( --without-gnutls )
128 + fi
129 +
130 + # The autodetection for these two commands can hang if localhost is
131 + # down or ICMP traffic is filtered. Bug #468296.
132 + myconf+=( --with-ping-command="/bin/ping -4 -n -U -w %d -c %d %s" )
133 +
134 + if use ipv6; then
135 + myconf+=( --with-ping6-command="/bin/ping -6 -n -U -w %d -c %d %s" )
136 + fi
137 +
138 + econf \
139 + $(use_with curl libcurl) \
140 + $(use_with curl uriparser) \
141 + $(use_with mysql) \
142 + $(use_with ipv6) \
143 + $(use_with ldap) \
144 + $(use_with postgres pgsql /usr) \
145 + $(use_with radius) \
146 + "${myconf[@]}" \
147 + --libexecdir="/usr/$(get_libdir)/nagios/plugins" \
148 + --sysconfdir="/etc/nagios"
149 +}
150 +
151 +DOCS=( ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ \
152 + NEWS README REQUIREMENTS SUPPORT THANKS )
153 +
154 +pkg_postinst() {
155 + elog "This ebuild has a number of USE flags that determine what you"
156 + elog "are able to monitor. Depending on what you want to monitor, some"
157 + elog "or all of these USE flags need to be set."
158 + elog
159 + elog "The plugins are installed in ${EROOT}/usr/$(get_libdir)/nagios/plugins"
160 +}