app-emulation/simh: drop old
[gentoo.git] / net-analyzer / monitoring-plugins / monitoring-plugins-2.2-r2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit eutils flag-o-matic multilib user
7
8 DESCRIPTION="50+ standard plugins for Icinga, Naemon, Nagios, Shinken, Sensu"
9 HOMEPAGE="https://www.monitoring-plugins.org/"
10 SRC_URI="https://www.monitoring-plugins.org/download/${P}.tar.gz"
11
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="amd64 ~arm ~arm64 ~sparc x86"
15 IUSE="gnutls ipv6 ldap libressl mysql dns fping game postgres radius samba snmp ssh +ssl"
16
17 # Most of the plugins use automagic dependencies, i.e. the plugin will
18 # get built if the binary it uses is installed. For example, check_snmp
19 # will be built only if snmpget from net-analyzer/net-snmp[-minimal] is
20 # installed. End result: most of our runtime dependencies are required
21 # at build time as well.
22 #
23 # REAL_DEPEND contains the dependencies that are actually needed to
24 # build. DEPEND contains those plus the automagic dependencies.
25 #
26 REAL_DEPEND="dev-lang/perl
27         ldap? ( net-nds/openldap )
28         mysql? ( virtual/mysql )
29         postgres? ( dev-db/postgresql:= )
30         ssl? (
31                 !gnutls? (
32                         !libressl? ( dev-libs/openssl:0= )
33                         libressl? ( dev-libs/libressl:= )
34                 )
35                 gnutls? ( net-libs/gnutls )
36         )
37         radius? ( net-dialup/freeradius-client )"
38
39 DEPEND="${REAL_DEPEND}
40         dns? ( net-dns/bind-tools )
41         game? ( games-util/qstat )
42         fping? ( net-analyzer/fping )
43         samba? ( net-fs/samba )
44         ssh? ( net-misc/openssh )
45         snmp? ( dev-perl/Net-SNMP
46                         net-analyzer/net-snmp[-minimal] )"
47
48 # Basically everything collides with nagios-plugins.
49 RDEPEND="${DEPEND}
50         !net-analyzer/nagios-plugins"
51
52 # At least one test is interactive.
53 RESTRICT="test"
54
55 PATCHES=( "${FILESDIR}/define-own-mysql-port-constant.patch" )
56
57 src_configure() {
58         append-flags -fno-strict-aliasing
59
60         # Use an array to prevent econf from mangling the ping args.
61         local myconf=()
62
63         if use ssl; then
64                 myconf+=( $(use_with !gnutls openssl /usr)
65                                   $(use_with gnutls gnutls /usr) )
66         else
67                 myconf+=( --without-openssl )
68                 myconf+=( --without-gnutls )
69         fi
70
71         # The autodetection for these two commands can hang if localhost is
72         # down or ICMP traffic is filtered. Bug #468296.
73         myconf+=( --with-ping-command="/bin/ping -n -U -w %d -c %d %s" )
74
75         if use ipv6; then
76                 myconf+=( --with-ping6-command="/bin/ping6 -n -U -w %d -c %d %s" )
77         fi
78
79         econf \
80                 $(use_with mysql) \
81                 $(use_with ipv6) \
82                 $(use_with ldap) \
83                 $(use_with postgres pgsql /usr) \
84                 $(use_with radius) \
85                 "${myconf[@]}" \
86                 --libexecdir="/usr/$(get_libdir)/nagios/plugins" \
87                 --sysconfdir="/etc/nagios"
88 }
89
90 DOCS=( ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ \
91                 NEWS README REQUIREMENTS SUPPORT THANKS )
92
93 pkg_preinst() {
94         enewgroup nagios
95         enewuser nagios -1 /bin/bash /var/nagios/home nagios
96 }
97
98 pkg_postinst() {
99         elog "This ebuild has a number of USE flags that determine what you"
100         elog "are able to monitor. Depending on what you want to monitor, some"
101         elog "or all of these USE flags need to be set."
102         elog
103         elog "The plugins are installed in ${EROOT%/}/usr/$(get_libdir)/nagios/plugins"
104 }