summaryrefslogtreecommitdiffstats
path: root/net-mgmt/nagios-plugins/Makefile
blob: 647eff235df9b3610782342c4287f8657e61bc2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Created by: Blaz Zupan <blaz@si.FreeBSD.org>
# $FreeBSD$

PORTNAME=	nagios-plugins
PORTVERSION=	2.1.1
PORTREVISION=	5
PORTEPOCH=	1
CATEGORIES=	net-mgmt
MASTER_SITES=	https://www.nagios-plugins.org/download/ \
		LOCAL/mat/${PORTNAME}

MAINTAINER=	mat@FreeBSD.org
COMMENT=	Plugins for Nagios

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/COPYING

CONFLICTS_INSTALL=	monitoring-plugins-*

USES=		charsetfix gmake perl5 libtool
USE_OPENSSL=	yes
USE_SUBMAKE=	yes

OPTIONS_DEFINE=	QSTAT FPING NETSNMP RADIUS MYSQL PGSQL LDAP IPV6 NLS DBI EXTRAOPTS SSH_PORTABLE
OPTIONS_SINGLE=	DNS
OPTIONS_SINGLE_DNS=	DNS_BASE DNS_BINDTOOLS DNS_BIND99 DNS_BIND910
OPTIONS_DEFAULT=IPV6 EXTRAOPTS DNS_BASE
OPTIONS_SUB=	yes

QSTAT_DESC=	Game server query support (check_game)
FPING_DESC=	Support for non-flooding fast ping (check_fping)
NETSNMP_DESC=	SNMP support (check_snmp)
RADIUS_DESC=	Radius support (check_radius)
MYSQL_DESC=	MySQL support (check_mysql)
PGSQL_DESC=	PostgreSQL support (check_pgsql)
LDAP_DESC=	OpenLDAP support (check_ldap)
DBI_DESC=	Check database using DBI
EXTRAOPTS_DESC=	Parsing of plugins ini config files for extra options
SSH_PORTABLE_DESC=	Build check_ssh with ports openssh (instead of base)

DNS_DESC=	Configuration of check_dig and check_dns (see help)

DNS_BASE_DESC=	>= 10 means drill for check_dig and no check_dns
DNS_BINDTOOLS_DESC=	Use dig and nslookup from dns/bind-tools
DNS_BIND99_DESC=	Use dig and nslookup from dns/bind99
DNS_BIND910_DESC=	Use dig and nslookup from dns/bind910

EXTRAOPTS_CONFIGURE_ENABLE=	extra-opts

GNU_CONFIGURE=	yes

NAGIOSUSER?=	nagios
NAGIOSGROUP?=	nagios
NAGIOSDIR?=	/var/spool/nagios

NAGIOSWWWDIR?=	www/nagios
NAGIOSHTMURL?=	/nagios
NAGIOSCGIURL?=	${NAGIOSHTMURL}/cgi-bin

CONFIGURE_ARGS+=--with-nagios-user=${NAGIOSUSER} \
		--with-nagios-group=${NAGIOSGROUP} \
		--with-cgiurl=${NAGIOSCGIURL} \
		--sbindir=${PREFIX}/${NAGIOSWWWDIR}/cgi-bin \
		--libexecdir=${PREFIX}/libexec/nagios \
		--datadir=${PREFIX}/share \
		--sysconfdir=${PREFIX}/etc/nagios \
		--localstatedir=${NAGIOSDIR} \
		--with-perl=${PERL} \
		--prefix=${PREFIX}

# Also, force some commands with their expected paths so that they don't get
# disabled.
CONFIGURE_ARGS+=ac_cv_path_PATH_TO_QMAIL_QSTAT=/var/qmail/bin/qmail-qstat \
		ac_cv_path_PATH_TO_PING=/sbin/ping \
		ac_cv_path_PATH_TO_PING6=/sbin/ping6 \
		--with-ping-command="/sbin/ping -n -c %d %s" \
		--with-ping6-command="/sbin/ping6 -n -c %d %s" \
		ac_cv_path_PATH_TO_SUDO=${LOCALBASE}/bin/sudo \
		ac_cv_path_PATH_TO_SMBCLIENT=${LOCALBASE}/bin/smbclient

CPPFLAGS+=	-I${LOCALBASE}/include
LIBS+=		-L${LOCALBASE}/lib

QSTAT_BUILD_DEPENDS=	qstat:games/qstat
QSTAT_RUN_DEPENDS=	qstat:games/qstat
QSTAT_CONFIGURE_OFF=	ac_cv_path_PATH_TO_QUAKESTAT= \
			ac_cv_path_PATH_TO_QSTAT=

IPV6_CONFIGURE_WITH=	ipv6

FPING_BUILD_DEPENDS=	fping:net/fping
FPING_RUN_DEPENDS=	fping:net/fping
FPING_CONFIGURE_OFF=	ac_cv_path_PATH_TO_FPING= \
			ac_cv_path_PATH_TO_FPING6=

NETSNMP_BUILD_DEPENDS=	snmpcheck:net-mgmt/net-snmp \
		p5-Net-SNMP>=0:net-mgmt/p5-Net-SNMP
NETSNMP_RUN_DEPENDS=	snmpcheck:net-mgmt/net-snmp \
		p5-Net-SNMP>=0:net-mgmt/p5-Net-SNMP
NETSNMP_CONFIGURE_OFF=	ac_cv_path_PATH_TO_SNMPGET= \
			ac_cv_path_PATH_TO_SNMPGETNEXT=

RADIUS_LIB_DEPENDS=	libradiusclient-ng.so:net/radiusclient
RADIUS_CONFIGURE_WITH=	radius

MYSQL_USE=	mysql=yes
MYSQL_CONFIGURE_WITH=	mysql=${LOCALBASE}

PGSQL_USES=	pgsql
PGSQL_CONFIGURE_WITH=	pgsql=${LOCALBASE}

LDAP_USE=	openldap=yes
LDAP_CONFIGURE_WITH=	ldap

NLS_USES=	gettext
NLS_CONFIGURE_ENABLE=	nls

DBI_LIB_DEPENDS=	libdbi.so:databases/libdbi
DBI_CONFIGURE_WITH=	dbi

DNS_BINDTOOLS_BUILD_DEPENDS=	${LOCALBASE}/bin/dig:dns/bind-tools
DNS_BINDTOOLS_CONFIGURE_ON=	--with-dig-command=${LOCALBASE}/bin/dig \
				--with-nslookup-command=${LOCALBASE}/bin/nslookup
DNS_BIND99_BUILD_DEPENDS=	${LOCALBASE}/bin/dig:dns/bind99
DNS_BIND99_CONFIGURE_ON=	--with-dig-command=${LOCALBASE}/bin/dig \
				--with-nslookup-command=${LOCALBASE}/bin/nslookup
DNS_BIND910_BUILD_DEPENDS=	${LOCALBASE}/bin/dig:dns/bind910
DNS_BIND910_CONFIGURE_ON=	--with-dig-command=${LOCALBASE}/bin/dig \
				--with-nslookup-command=${LOCALBASE}/bin/nslookup

SSH_PORTABLE_BUILD_DEPENDS=	${LOCALBASE}/bin/ssh:security/openssh-portable
SSH_PORTABLE_RUN_DEPENDS:=	${SSH_PORTABLE_BUILD_DEPENDS}
SSH_PORTABLE_CONFIGURE_ON=	--with-ssh-command=${LOCALBASE}/bin/ssh

.include <bsd.port.options.mk>

.if ${OSVERSION} > 1000055 && ${PORT_OPTIONS:MDNS_BASE}
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-dig-to-drill.diff
CONFIGURE_ARGS+=--with-dig-command=/usr/bin/drill \
		ac_cv_path_PATH_TO_NSLOOKUP=
PLIST_SUB+=	CHECK_DNS="@comment "
.else
.  if ${PORT_OPTIONS:MDNS_BASE}
CONFIGURE_ARGS+=	--with-dig-command=/usr/bin/dig \
			--with-nslookup-command=/usr/bin/nslookup
.  endif
PLIST_SUB+=	CHECK_DNS=""
.endif

.if !exists(/usr/bin/ssh) && empty(PORT_OPTIONS:MSSH_PORTABLE)
PLIST_SUB+=	SSH="@comment "
.else
PLIST_SUB+=	SSH=""
.endif

post-patch:
.for file in check_by_ssh.c check_disk.c check_http.c check_mrtgtraf.c \
	check_nagios.c check_ntp.c check_ntp_peer.c check_ntp_time.c \
	check_pgsql.c check_snmp.c check_ssh.c check_swap.c check_time.c \
	check_users.c
	@${REINPLACE_CMD} -e 's|setlocale (LC_ALL, "");|setlocale (LC_ALL, ""); setlocale(LC_NUMERIC, "C");|g' ${WRKSRC}/plugins/${file}
.endfor
	@${REINPLACE_CMD} -e 's|chown root|${TRUE}|g' ${WRKSRC}/plugins-root/Makefile.in
	# add a fake PATH so that it gets set to a correct value during build.
	@${REINPLACE_CMD} -e "s|$$ENV{'PATH'}=''|$$ENV{'PATH'}='foo'|; \
		s|/usr/bin/|${LOCALBASE}/bin/|g" \
		${WRKSRC}/plugins-scripts/*.pl

.include <bsd.port.mk>
OpenPOWER on IntegriCloud