| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
inherit flag-o-matic
|
|
6 |
inherit fcaps flag-o-matic
|
| 7 |
7 |
|
| 8 |
8 |
DESCRIPTION="50+ standard plugins for Icinga, Naemon, Nagios, Shinken, Sensu"
|
| 9 |
|
HOMEPAGE="https://www.monitoring-plugins.org/"
|
|
9 |
HOMEPAGE="https://www.monitoring-plugins.org/
|
|
10 |
https://github.com/monitoring-plugins/monitoring-plugins/"
|
| 10 |
11 |
SRC_URI="https://www.monitoring-plugins.org/download/${P}.tar.gz"
|
| 11 |
12 |
|
| 12 |
13 |
LICENSE="GPL-3"
|
| 13 |
14 |
SLOT="0"
|
| 14 |
|
KEYWORDS="amd64 ~arm ~arm64 ~sparc x86"
|
| 15 |
|
IUSE="curl gnutls ipv6 ldap mysql dns fping game postgres radius samba snmp ssh +ssl"
|
|
15 |
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~sparc ~x86"
|
|
16 |
IUSE="curl ipv6 ldap mysql dns fping game postgres radius rpc samba snmp ssh suid"
|
| 16 |
17 |
|
| 17 |
18 |
# Most of the plugins use automagic dependencies, i.e. the plugin will
|
| 18 |
19 |
# get built if the binary it uses is installed. For example, check_snmp
|
| ... | ... | |
| 23 |
24 |
# REAL_DEPEND contains the dependencies that are actually needed to
|
| 24 |
25 |
# build. DEPEND contains those plus the automagic dependencies.
|
| 25 |
26 |
#
|
|
27 |
# Note: openssl is required unconditionally because the build fails
|
|
28 |
# without it:
|
|
29 |
#
|
|
30 |
# * https://github.com/monitoring-plugins/monitoring-plugins/issues/2135
|
|
31 |
#
|
| 26 |
32 |
REAL_DEPEND="dev-lang/perl
|
| 27 |
33 |
curl? (
|
| 28 |
34 |
dev-libs/uriparser
|
| ... | ... | |
| 31 |
37 |
ldap? ( net-nds/openldap:= )
|
| 32 |
38 |
mysql? ( || ( dev-db/mysql-connector-c dev-db/mariadb-connector-c ) )
|
| 33 |
39 |
postgres? ( dev-db/postgresql:= )
|
| 34 |
|
ssl? (
|
| 35 |
|
!gnutls? (
|
| 36 |
|
dev-libs/openssl:0=
|
| 37 |
|
)
|
| 38 |
|
gnutls? ( net-libs/gnutls )
|
| 39 |
|
)
|
|
40 |
dev-libs/openssl:0=
|
| 40 |
41 |
radius? ( net-dialup/freeradius-client )"
|
| 41 |
42 |
|
| 42 |
43 |
DEPEND="${REAL_DEPEND}
|
| 43 |
44 |
dns? ( net-dns/bind )
|
| 44 |
45 |
game? ( games-util/qstat )
|
| 45 |
46 |
fping? ( net-analyzer/fping )
|
|
47 |
rpc? ( net-nds/rpcbind )
|
| 46 |
48 |
samba? ( net-fs/samba )
|
| 47 |
49 |
ssh? ( virtual/openssh )
|
| 48 |
50 |
snmp? ( dev-perl/Net-SNMP
|
| ... | ... | |
| 50 |
52 |
|
| 51 |
53 |
# Basically everything collides with nagios-plugins.
|
| 52 |
54 |
RDEPEND="${DEPEND}
|
| 53 |
|
acct-group/nagios
|
| 54 |
|
acct-user/nagios
|
| 55 |
55 |
!net-analyzer/nagios-plugins"
|
| 56 |
56 |
|
| 57 |
57 |
# At least one test is interactive.
|
| ... | ... | |
| 67 |
67 |
alignof
|
| 68 |
68 |
)
|
| 69 |
69 |
|
|
70 |
DOCS=( ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ \
|
|
71 |
NEWS README REQUIREMENTS SUPPORT THANKS )
|
|
72 |
|
|
73 |
src_prepare() {
|
|
74 |
if ! use snmp; then
|
|
75 |
# automagic detection becomes a much bigger problem when the
|
|
76 |
# feature breaks the build
|
|
77 |
sed -i configure -e '/EXTRAS="\$EXTRAS check_snmp"/d' \
|
|
78 |
|| die "failed to disable check_snmp"
|
|
79 |
fi
|
|
80 |
default
|
|
81 |
}
|
|
82 |
|
| 70 |
83 |
src_configure() {
|
|
84 |
# https://github.com/monitoring-plugins/monitoring-plugins/issues/2295
|
| 71 |
85 |
append-flags -fno-strict-aliasing
|
| 72 |
86 |
|
| 73 |
87 |
# Use an array to prevent econf from mangling the ping args.
|
| 74 |
88 |
local myconf=()
|
| 75 |
89 |
|
| 76 |
|
if use ssl; then
|
| 77 |
|
myconf+=( $(use_with !gnutls openssl /usr)
|
| 78 |
|
$(use_with gnutls gnutls /usr) )
|
| 79 |
|
else
|
| 80 |
|
myconf+=( --without-openssl )
|
| 81 |
|
myconf+=( --without-gnutls )
|
| 82 |
|
fi
|
| 83 |
|
|
| 84 |
90 |
# The autodetection for these two commands can hang if localhost is
|
| 85 |
91 |
# down or ICMP traffic is filtered (bug #468296). But also the path
|
| 86 |
92 |
# likes to move around on us (bug #883729).
|
| ... | ... | |
| 98 |
104 |
$(use_with ldap) \
|
| 99 |
105 |
$(use_with postgres pgsql /usr) \
|
| 100 |
106 |
$(use_with radius) \
|
|
107 |
--with-openssl=/usr \
|
|
108 |
--without-gnutls \
|
| 101 |
109 |
"${myconf[@]}" \
|
| 102 |
110 |
--libexecdir="/usr/$(get_libdir)/nagios/plugins" \
|
| 103 |
111 |
--sysconfdir="/etc/nagios"
|
| 104 |
112 |
}
|
| 105 |
113 |
|
| 106 |
|
DOCS=( ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ \
|
| 107 |
|
NEWS README REQUIREMENTS SUPPORT THANKS )
|
|
114 |
src_install() {
|
|
115 |
default
|
|
116 |
|
|
117 |
# Prefer capabilities to suid. Beware that fcaps and fperms require
|
|
118 |
# two different kinds of paths; fperms always prepends ${ED}, but
|
|
119 |
# fcaps only does so it if the path does not already start with a
|
|
120 |
# slash. Anyway, begin by removing suid unconditionally.
|
|
121 |
local pd="usr/$(get_libdir)/nagios/plugins"
|
|
122 |
|
|
123 |
if use filecaps; then
|
|
124 |
local flags msg
|
|
125 |
if use suid; then
|
|
126 |
# use suid if setcap fails
|
|
127 |
flags="-m u+s"
|
|
128 |
msg=" (with suid fallback)"
|
|
129 |
fi
|
|
130 |
einfo "replacing suid bits with filecaps${msg}"
|
|
131 |
fperms ug-s /"${pd}"/check_{dhcp,icmp}
|
|
132 |
fcaps ${flags} cap_net_bind_service "${pd}"/check_dhcp
|
|
133 |
fcaps ${flags} cap_net_bind_service,cap_net_raw "${pd}"/check_icmp
|
|
134 |
else
|
|
135 |
# no filecaps, just suid (or not)
|
|
136 |
if ! use suid; then
|
|
137 |
einfo "stripping suid bits"
|
|
138 |
fperms ug-s /"${pd}"/check_{dhcp,icmp}
|
|
139 |
fi
|
|
140 |
fi
|
|
141 |
}
|
| 108 |
142 |
|
| 109 |
143 |
pkg_postinst() {
|
| 110 |
144 |
elog "This ebuild has a number of USE flags that determine what you"
|