aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/collectd5/Makefile
blob: f2f6d368557c4f5a69e69b9f7909a3f6cb0dfec5 (plain) (blame)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# Created by: Matt Peterson <matt@peterson.org>
# $FreeBSD$
PORTNAME=   collectd
PORTVERSION=    5.1.0
PORTREVISION=   5
CATEGORIES= net-mgmt
MASTER_SITES=   http://collectd.org/files/

MAINTAINER= ports@bsdserwis.com
COMMENT=    Systems & network statistics collection daemon

USE_GMAKE=  yes
GNU_CONFIGURE=  yes
USE_AUTOTOOLS=  autoconf autoheader automake libltdl
WANT_GNOME= yes

LATEST_LINK=    collectd5

OPTIONS_DEFINE=     CGI BIND DEBUG GCRYPT VIRT
OPTIONS_GROUP=      INPUT OUTPUT
OPTIONS_GROUP_OUTPUT=   RRDTOOL RRDCACHED WRITE_GRAPHITE WRITE_HTTP NOTIFYEMAIL
OPTIONS_GROUP_INPUT=    APACHE APCUPS CURL CURL_JSON CURL_XML DBI DISK GCRYPT \
            NUTUPS INTERFACE IPMI MBMON MEMCACHED MYSQL NGINX \
            OPENVPN PDNS PGSQL PING PYTHON ROUTEROS SNMP TABLE \
            TOKYOTYRANT VARNISH XMMS

OPTIONS_DEFAULT=    BIND INTERFACE PING SNMP RRDTOOL RRDCACHED

CGI_DESC=       Install collection.cgi (requires RRDTOOL)
BIND_DESC=      Enable BIND 9.5+ statistics
DEBUG_DESC=     Enable debugging
GCRYPT_DESC=        Build with libgcrypt
VIRT_DESC=      Build with libvirt
# INPUT
APACHE_DESC=        Apache mod_status (libcurl)
APCUPS_DESC=        APC UPS (apcupsd)
CURL_DESC=      CURL generic web statistics
CURL_JSON_DESC=     CURL JSON generic web statistics
CURL_XML_DESC=      CURL XML generic web statistics
DBI_DESC=       database abstraction library
DISK_DESC=      Disk performance statistics
NUTUPS_DESC=        NUT UPS daemon
INTERFACE_DESC=     Network interfaces (libstatgrab)
IPMI_DESC=      IPMI plugin (openipmi)
MBMON_DESC=     MBMon 
MEMCACHED_DESC=     Memcached
MYSQL_DESC=     MySQL
NOTIFYEMAIL_DESC=   Email notifications (libesmtp)
NGINX_DESC=     Nginx
OPENVPN_DESC=       OpenVPN statistics
PDNS_DESC=      PowerDNS
PGSQL_DESC=     PostgreSQL
PING_DESC=      Network latency (liboping)
PYTHON_DESC=        Python plugin
ROUTEROS_DESC=      RouterOS plugin
SNMP_DESC=      SNMP
TABLE_DESC=     Table plugin
TOKYOTYRANT_DESC=   Tokyotyrant database
VARNISH_DESC=       Varnish plugin
XMMS_DESC=      XMMS
# OUTPUT
RRDTOOL_DESC=       RRDTool
RRDCACHED_DESC=     RRDTool Cached (requires RRDTOOL)
WRITE_GRAPHITE_DESC=    write_graphite
WRITE_HTTP_DESC=    write_http

MAN1=       collectd.1 collectd-nagios.1 collectdmon.1 collectdctl.1
MAN5=       collectd.conf.5 collectd-email.5 collectd-exec.5 \
        collectd-snmp.5 collectd-unixsock.5 collectd-perl.5 \
        collectd-java.5 collectd-python.5 types.db.5 collectd-threshold.5
USE_RC_SUBR=    collectd collectdmon

USE_LDCONFIG=   yes

CONFLICTS=  collectd-4.[0-9]*

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

.include <bsd.port.options.mk>

# NOTE: Feel free to submit patches adding support for any of these
#       disabled plugins.  If a plugin requires external dependencies,
#       make it optional through OPTIONS defaulting to Off.  Some of
#       these are Linux specific, but others will probably run on
#       FreeBSD as well, given a bit of careful attention.
CONFIGURE_ARGS= --localstatedir=/var \
        --disable-getifaddrs \
        --disable-apple_sensors \
        --disable-ascent \
        --disable-battery \
        --disable-conntrack \
        --disable-contextswitch \
        --disable-cpufreq \
        --disable-entropy \
        --disable-fscache \
        --disable-gmond \
        --disable-hddtemp \
        --disable-ipmi \
        --disable-iptables \
        --disable-ipvs \
        --disable-irq \
        --disable-java \
        --without-java \
        --disable-madwifi \
        --disable-match_empty_counter \
        --disable-match_hashed \
        --disable-match_regex \
        --disable-match_timediff \
        --disable-match_value \
        --disable-memcachec \
        --disable-modbus \
        --without-libmodbus \
        --disable-multimeter \
        --disable-netapp \
        --without-libnetapp \
        --disable-netlink \
        --disable-nfs \
        --disable-notify_desktop \
        --disable-notify_email \
        --disable-olsrd \
        --disable-onewire \
        --disable-oracle \
        --disable-perl \
        --disable-pinba \
        --disable-protocols \
        --disable-sensors \
        --disable-serial \
        --disable-table \
        --disable-tape \
        --disable-target_notification \
        --disable-target_replace \
        --disable-target_scale \
        --disable-target_set \
        --disable-teamspeak2 \
        --disable-ted \
        --disable-thermal \
        --disable-vmem \
        --disable-vserver \
        --disable-wireless \
        --without-perl-bindings \
        --without-librabbitmq \
        --disable-varnish \
        --without-libvarnish \
        --without-libcredis \
        --without-libganglia \
        --without-libupsclient \
        --without-libesmtp \
        --disable-static

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=--enable-debug
.endif

.if ${PORT_OPTIONS:MCGI}
RUN_DEPENDS+=   p5-URI>=0:${PORTSDIR}/net/p5-URI \
        p5-CGI.pm>=0:${PORTSDIR}/www/p5-CGI.pm \
        p5-Data-Dumper>=0:${PORTSDIR}/devel/p5-Data-Dumper \
        p5-HTML-Parser>=0:${PORTSDIR}/www/p5-HTML-Parser
PLIST_SUB+= CGI=""
.  if empty(PORT_OPTIONS:MRRDTOOL)
IGNORE=     CGI requires RRDTOOL. Either select RRDTOOL or deselect CGI
.  endif
.else
PLIST_SUB+= CGI="@comment "
.endif

.if ${PORT_OPTIONS:MBIND}
CONFIGURE_ARGS+=--enable-bind
LIB_DEPENDS+=   curl:${PORTSDIR}/ftp/curl
LIB_DEPENDS+=   xml2:${PORTSDIR}/textproc/libxml2
PLIST_SUB+= BIND=""
.else
CONFIGURE_ARGS+=--disable-bind
PLIST_SUB+= BIND="@comment "
.endif

.if ${PORT_OPTIONS:MAPACHE}
CONFIGURE_ARGS+=--enable-apache
LIB_DEPENDS+=   curl:${PORTSDIR}/ftp/curl
PLIST_SUB+= APACHE=""
.else
CONFIGURE_ARGS+=--disable-apache
PLIST_SUB+= APACHE="@comment "
.endif

.if ${PORT_OPTIONS:MAPCUPS}
CONFIGURE_ARGS+=--enable-apcups
BUILD_DEPENDS+= ${LOCALBASE}/sbin/apcupsd:${PORTSDIR}/sysutils/apcupsd
PLIST_SUB+= APCUPS=""
.else
CONFIGURE_ARGS+=--disable-apcups
PLIST_SUB+= APCUPS="@comment "
.endif

.if ${PORT_OPTIONS:MCURL}
CONFIGURE_ARGS+=--enable-curl --with-libcurl=${LOCALBASE}
LIB_DEPENDS+=   curl:${PORTSDIR}/ftp/curl
PLIST_SUB+= CURL=""
.else
CONFIGURE_ARGS+=--disable-curl
PLIST_SUB+= CURL="@comment "
.endif

.if ${PORT_OPTIONS:MCURL_JSON}
.if empty(PORT_OPTIONS:MCURL)
IGNORE= using CURL_JSON requires CURL support
.endif
CONFIGURE_ARGS+=--enable-curl_json
LIB_DEPENDS+=   yajl:${PORTSDIR}/devel/yajl
PLIST_SUB+= CURL_JSON=""
.else
CONFIGURE_ARGS+=--disable-curl_json --without-libyajl
PLIST_SUB+= CURL_JSON="@comment "
.endif

.if ${PORT_OPTIONS:MCURL_XML}
.if empty(PORT_OPTIONS:MCURL)
IGNORE= using CURL_XML requires CURL support
.endif
CONFIGURE_ARGS+=--enable-curl_xml
LIB_DEPENDS+=   xml2:${PORTSDIR}/textproc/libxml2
PLIST_SUB+= CURL_XML=""
.else
CONFIGURE_ARGS+=--disable-curl_xml
PLIST_SUB+= CURL_XML="@comment "
.endif

.if ${PORT_OPTIONS:MDBI}
CONFIGURE_ARGS+=--enable-dbi --with-libdbi=${LOCALBASE}
LIB_DEPENDS+=   dbi:${PORTSDIR}/databases/libdbi
PLIST_SUB+= DBI=""
.else
CONFIGURE_ARGS+=--disable-dbi --without-libdbi
PLIST_SUB+= DBI="@comment "
.endif

.if ${PORT_OPTIONS:MDISK}
CONFIGURE_ARGS+=--enable-disk
PLIST_SUB+= DISK=""
.else
CONFIGURE_ARGS+=--disable-disk
PLIST_SUB+= DISK="@comment "
.endif

.if ${PORT_OPTIONS:MGCRYPT}
CONFIGURE_ARGS+=--with-libgcrypt-prefix=${LOCALBASE}
LIB_DEPENDS+=   gcrypt:${PORTSDIR}/security/libgcrypt
.endif

.if ${PORT_OPTIONS:MNUTUPS}
CONFIGURE_ARGS+=--enable-nut --with-libupsclient
LIB_DEPENDS+=   upsclient:${PORTSDIR}/sysutils/nut
PLIST_SUB+= NUTUPS=""
.else
CONFIGURE_ARGS+=--disable-nut
PLIST_SUB+= NUTUPS="@comment "
.endif

.if ${PORT_OPTIONS:MINTERFACE}
USE_PKGCONFIG=  yes
CONFIGURE_ARGS+=--enable-interface
LIB_DEPENDS+=   statgrab:${PORTSDIR}/devel/libstatgrab
PLIST_SUB+= INTERFACE=""
CONFIGURE_ENV+= LIBS="`pkg-config --libs libstatgrab`"
.else
CONFIGURE_ARGS+=--disable-interface
PLIST_SUB+= INTERFACE="@comment "
.endif

.if ${PORT_OPTIONS:MMBMON}
CONFIGURE_ARGS+=--enable-mbmon
RUN_DEPENDS+=   ${LOCALBASE}/bin/mbmon:${PORTSDIR}/sysutils/mbmon
PLIST_SUB+= MBMON=""
.else
CONFIGURE_ARGS+=--disable-mbmon
PLIST_SUB+= MBMON="@comment "
.endif

.if ${PORT_OPTIONS:MMEMCACHED}
LIB_DEPENDS+=   memcached:${PORTSDIR}/databases/libmemcached
CONFIGURE_ARGS+=--enable-memcached
CONFIGURE_ARGS+=--with-libmemcached=${LOCALBASE}
PLIST_SUB+= MEMCACHED=""
.else
CONFIGURE_ARGS+=--disable-memcached --without-libmemcached
PLIST_SUB+= MEMCACHED="@comment "
.endif

.if ${PORT_OPTIONS:MMYSQL}
USE_MYSQL=  yes
CONFIGURE_ARGS+=--enable-mysql
PLIST_SUB+= MYSQL=""
.else
CONFIGURE_ARGS+=--disable-mysql
PLIST_SUB+= MYSQL="@comment "
.endif

.if ${PORT_OPTIONS:MIPMI}
USE_PKGCONFIG=  yes
CONFIGURE_ARGS+=--enable-ipmi
LIB_DEPENDS+=   OpenIPMI:${PORTSDIR}/sysutils/openipmi
PLIST_SUB+= IPMI=""
.else
CONFIGURE_ARGS+=--disable-ipmi
PLIST_SUB+= IPMI="@comment "
.endif

.if ${PORT_OPTIONS:MNOTIFYEMAIL}
LIB_DEPENDS+=   esmtp:${PORTSDIR}/mail/libesmtp
CONFIGURE_ARGS+=--enable-notify_email
CONFIGURE_ARGS+=--with-libesmtp=${PREFIX}
PLIST_SUB+= NOTIFYEMAIL=""
.else
CONFIGURE_ARGS+=--disable-notify_email
PLIST_SUB+= NOTIFYEMAIL="@comment "
.endif

.if ${PORT_OPTIONS:MNGINX}
RUN_DEPENDS+=   nginx:${PORTSDIR}/www/nginx
LIB_DEPENDS+=   curl:${PORTSDIR}/ftp/curl
CONFIGURE_ARGS+=--enable-nginx
PLIST_SUB+= NGINX=""
.else
CONFIGURE_ARGS+=--disable-nginx
PLIST_SUB+= NGINX="@comment "
.endif

.if ${PORT_OPTIONS:MOPENVPN}
CONFIGURE_ARGS+=--enable-openvpn
RUN_DEPENDS+=   ${LOCALBASE}/sbin/openvpn:${PORTSDIR}/security/openvpn
PLIST_SUB+= OPENVPN=""
.else
CONFIGURE_ARGS+=--disable-openvpn
PLIST_SUB+= OPENVPN="@comment "
.endif

.if ${PORT_OPTIONS:MPDNS}
USE_PDNS=   yes
CONFIGURE_ARGS+=--enable-powerdns
PLIST_SUB+= PDNS=""
.else
CONFIGURE_ARGS+=--disable-powerdns
PLIST_SUB+= PDNS="@comment "
.endif

.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL=  yes
CONFIGURE_ARGS+=--enable-postgresql
PLIST_SUB+= PGSQL=""
.else
CONFIGURE_ARGS+=--disable-postgresql
PLIST_SUB+= PGSQL="@comment "
.endif

.if ${PORT_OPTIONS:MPING}
LIB_DEPENDS+=   oping:${PORTSDIR}/net/liboping
CONFIGURE_ARGS+=--enable-ping
PLIST_SUB+= PING=""
.else
CONFIGURE_ARGS+=--disable-ping
PLIST_SUB+= PING="@comment "
.endif

.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON=     yes
CONFIGURE_ARGS+=--enable-python
PLIST_SUB+= PYTHON=""
.else
CONFIGURE_ARGS+=--disable-python
PLIST_SUB+= PYTHON="@comment "
.endif

.if ${PORT_OPTIONS:MROUTEROS}
LIB_DEPENDS+=   routeros:${PORTSDIR}/net/librouteros
CONFIGURE_ARGS+=--enable-routeros --with-librouteros=${LOCALBASE}
PLIST_SUB+= ROUTEROS=""
.else
CONFIGURE_ARGS+=--disable-routeros --without-librouteros
PLIST_SUB+= ROUTEROS="@comment "
.endif

.if ${PORT_OPTIONS:MRRDTOOL}
LIB_DEPENDS+=   rrd:${PORTSDIR}/databases/rrdtool
CONFIGURE_ARGS+=--enable-rrdtool
PLIST_SUB+= RRD=""
.else
CONFIGURE_ARGS+=--disable-rrdtool
PLIST_SUB+= RRD="@comment "
.endif

.if ${PORT_OPTIONS:MRRDCACHED} && ${PORT_OPTIONS:MRRDTOOL}
CONFIGURE_ARGS+=--enable-rrdcached
PLIST_SUB+= RRDCACHED=""
.else
CONFIGURE_ARGS+=--disable--rrdcached
PLIST_SUB+= RRDCACHED="@comment "
.endif

.if ${PORT_OPTIONS:MSNMP}
LIB_DEPENDS+=   netsnmp:${PORTSDIR}/net-mgmt/net-snmp
CONFIGURE_ARGS+=--enable-snmp
PLIST_SUB+= SNMP=""
.else
CONFIGURE_ARGS+=--disable-snmp
PLIST_SUB+= SNMP="@comment "
.endif

.if ${PORT_OPTIONS:MTABLE}
CONFIGURE_ARGS+=--enable-table
PLIST_SUB+= TABLE=""
.else
CONFIGURE_ARGS+=--disable-table
PLIST_SUB+= TABLE="@comment "
.endif

.if ${PORT_OPTIONS:MTOKYOTYRANT}
LIB_DEPENDS+=   tokyotyrant:${PORTSDIR}/databases/tokyotyrant
CONFIGURE_ARGS+=--enable-tokyotyrant
CONFIGURE_ARGS+=--with-libtokyotyrant=${LOCALBASE}
PLIST_SUB+= TOKYOTYRANT=""
.else
CONFIGURE_ARGS+=--disable-tokyotyrant --without-libtokyotyrant
PLIST_SUB+= TOKYOTYRANT="@comment "
.endif

.if ${PORT_OPTIONS:MVARNISH}
LIB_DEPENDS+=   varnishapi:${PORTSDIR}/www/varnish
CONFIGURE_ARGS+=--enable-varnish
CONFIGURE_ARGS+=--with-libvarnish=${PREFIX}
PLIST_SUB+= VARNISH=""
.else
CONFIGURE_ARGS+=--disable-varnish
PLIST_SUB+= VARNISH="@comment "
.endif

.if ${PORT_OPTIONS:MVIRT}
CONFIGURE_ARGS+=--enable-libvirt
LIB_DEPENDS+=   virt.1000:${PORTSDIR}/devel/libvirt
PLIST_SUB+= VIRT=""
.else
CONFIGURE_ARGS+=--disable-libvirt
PLIST_SUB+= VIRT="@comment "
.endif

.if ${PORT_OPTIONS:MWRITE_GRAPHITE}
CONFIGURE_ARGS+=--enable-write_graphite
PLIST_SUB+= WRITE_GRAPHITE=""
.else
CONFIGURE_ARGS+=--disable-write_graphite
PLIST_SUB+= WRITE_GRAPHITE="@comment "
.endif

.if ${PORT_OPTIONS:MWRITE_HTTP}
CONFIGURE_ARGS+=--enable-write_http
PLIST_SUB+= WRITE_HTTP=""
.else
CONFIGURE_ARGS+=--disable-write_http
PLIST_SUB+= WRITE_HTTP="@comment "
.endif

.if ${PORT_OPTIONS:MXMMS}
LIB_DEPENDS+=   xmms:${PORTSDIR}/multimedia/xmms
CONFIGURE_ARGS+=--enable-xmms
CFLAGS+=    `xmms-config --cflags`
PLIST_SUB+= XMMS=""
.else
CONFIGURE_ARGS+=--disable-xmms
PLIST_SUB+= XMMS="@comment "
.endif

AUTOTOOLSFILES= aclocal.m4

post-patch:
    @${REINPLACE_CMD} -e 's|1.11.1|%%AUTOMAKE_APIVER%%|g' \
              -e 's|2.67|%%AUTOCONF_VERSION%%|g' \
              ${WRKSRC}/aclocal.m4
    @${REINPLACE_CMD} \
        -e 's;@prefix@/var/;/var/;' \
        -e 's;/var/lib/;/var/db/;' \
        ${WRKSRC}/src/collectd.conf.in
    @${REINPLACE_CMD} -e '/$$[(]mkinstalldirs)/d' ${WRKSRC}/Makefile.in
    @${REINPLACE_CMD} \
        -e 's;/etc/collection\.conf;${WWWDIR}/collection.conf;' \
        ${WRKSRC}/contrib/collection.cgi
    @${REINPLACE_CMD} \
        -e 's;/opt/collectd/var/lib;/var/db;' \
        -e 's;/opt/collectd/lib;${PREFIX}/lib;' \
        ${WRKSRC}/contrib/collection.conf
    @${REINPLACE_CMD} \
        -e 's;{libdir}/pkgconfig;{prefix}/libdata/pkgconfig;' \
        ${WRKSRC}/configure.in

post-install:
    ${MKDIR} /var/db/collectd
    if [ ! -f ${PREFIX}/etc/collectd.conf ]; then \
        ${CP} -p ${PREFIX}/etc/collectd.conf.sample \
            ${PREFIX}/etc/collectd.conf ; \
    fi
.if ${PORT_OPTIONS:MCGI}
    ${MKDIR} ${WWWDIR}
    ${INSTALL_SCRIPT} ${WRKSRC}/contrib/collection.cgi ${WWWDIR}/
    ${INSTALL_DATA} ${WRKSRC}/contrib/collection.conf \
        ${WWWDIR}/collection.conf.sample
    if [ ! -f ${WWWDIR}/collection.conf ]; then \
        ${CP} -p ${WWWDIR}/collection.conf.sample \
            ${WWWDIR}/collection.conf ; \
    fi
.endif

.include <bsd.port.mk>