aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/collectd
diff options
context:
space:
mode:
authoritetcu <itetcu@FreeBSD.org>2008-05-06 18:45:17 +0800
committeritetcu <itetcu@FreeBSD.org>2008-05-06 18:45:17 +0800
commitccaf3a88cb3698c83290eeb032ebedd7a3a68711 (patch)
tree1b43332dbceadd4691806825ed17f528e97eed85 /net-mgmt/collectd
parent9926e98df9d754169ced33cba0b9b7d76c0c3432 (diff)
downloadfreebsd-ports-gnome-ccaf3a88cb3698c83290eeb032ebedd7a3a68711.tar.gz
freebsd-ports-gnome-ccaf3a88cb3698c83290eeb032ebedd7a3a68711.tar.zst
freebsd-ports-gnome-ccaf3a88cb3698c83290eeb032ebedd7a3a68711.zip
- Transfer maintainership to daniel@roe.ch [1]
- Do not delete modified config files on uninstall [2] - Reduce filesystem hierarchy pollution by moving $PREFIX/var/{run,lib}/* to /var/run (PID file) and /var/db/collectd (default location of databases) [2] - Add an rc script [2] - Optionally install collection.cgi from contrib/ [2] - Fix WITH_APACHE dependencies and plist [1] - Fix WITH_XMMS and WITH_INTERFACE dependencies [2] - fixes for depends, plist, ... [3] PR: ports/122791 [1], ports/123367 [2] Submitted by: Daniel Roethlisberger [1],[2], itetcu@ (me) [3] Approved by: Matt Peterson (former maintainer) [2]
Diffstat (limited to 'net-mgmt/collectd')
-rw-r--r--net-mgmt/collectd/Makefile182
-rw-r--r--net-mgmt/collectd/files/collectd.in27
-rw-r--r--net-mgmt/collectd/files/patch-src__collectd.h20
-rw-r--r--net-mgmt/collectd/pkg-descr2
-rw-r--r--net-mgmt/collectd/pkg-plist17
5 files changed, 172 insertions, 76 deletions
diff --git a/net-mgmt/collectd/Makefile b/net-mgmt/collectd/Makefile
index 12b22809322f..963f02ca400f 100644
--- a/net-mgmt/collectd/Makefile
+++ b/net-mgmt/collectd/Makefile
@@ -7,49 +7,46 @@
PORTNAME= collectd
PORTVERSION= 4.1.2
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net-mgmt
MASTER_SITES= http://collectd.org/files/ \
- http://matt.peterson.org/FreeBSD/ports/
+ http://mirror.roe.ch/dist/${PORTNAME}/
-MAINTAINER= matt@peterson.org
+MAINTAINER= daniel@roe.ch
COMMENT= Systems & network statistics collection daemon
USE_GMAKE= yes
GNU_CONFIGURE= yes
-
-OPTIONS= APACHE "Apache mod_status statistics (libcurl)" Off \
- APCUPS "APC UPS support" Off \
- DEBUG "enable debugging" Off \
- INTERFACE "Network interface statistics (libstatgrab)" On \
- MBMON "Query mbmond" Off \
- MYSQL "MySQL statistics" Off \
- PING "Network latency statistics (liboping)" On \
- RRDTOOL "RRDTool output plugin" On \
- SNMP "SNMP support" On \
- XMMS "XMMS statistics" Off
+WANT_GNOME= yes
+
+OPTIONS= CGI "Install collection.cgi (requires RRDTOOL)" Off \
+ DEBUG "Enable debugging" Off \
+ APACHE "Input: Apache mod_status (libcurl)" Off \
+ APCUPS "Input: APC UPS (apcupsd)" Off \
+ INTERFACE "Input: Network interfaces (libstatgrab)" On \
+ MBMON "Input: MBMon" Off \
+ MYSQL "Input: MySQL" Off \
+ PING "Input: Network latency (liboping)" On \
+ SNMP "Input: SNMP" On \
+ XMMS "Input: XMMS" Off \
+ RRDTOOL "Output: RRDTool" On
MAN1= collectd.1 collectd-nagios.1
MAN5= collectd.conf.5 collectd-email.5 collectd-exec.5 \
collectd-snmp.5 collectd-unixsock.5 collectd-perl.5
+USE_RC_SUBR= collectd
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
-.if defined(WITH_XMMS) || defined(WITH_INTERFACE)
-USE_GNOME= pkgconfig
-. if defined(WITH_XMMS)
-USE_GNOME+= glib
-. endif
-.endif
-
.include <bsd.port.pre.mk>
.if ( ${OSVERSION} < 601103 )
-BROKEN= Need bind9 import post 6.1
+BROKEN= Need bind9 import post 6.1
.endif
-CONFIGURE_ARGS= --disable-apple_sensors \
+CONFIGURE_ARGS= --localstatedir=/var \
+ --disable-apple_sensors \
--disable-battery \
--disable-hddtemp \
--disable-multimeter \
@@ -61,92 +58,135 @@ CONFIGURE_ARGS= --disable-apple_sensors \
--disable-wireless
.if defined(WITH_DEBUG)
-CONFIGURE_ARGS+= --enable-debug
+CONFIGURE_ARGS+=--enable-debug
+.endif
+
+.if defined(WITH_CGI)
+RUN_DEPENDS+= ${SITE_PERL}/URI/Escape.pm:${PORTSDIR}/net/p5-URI \
+ ${SITE_PERL}/CGI.pm:${PORTSDIR}/www/p5-CGI.pm \
+ ${SITE_PERL}/${PERL_ARCH}/Data/Dumper.pm:${PORTSDIR}/devel/p5-Data-Dumper
+PLIST_SUB+= CGI=""
.else
-PLIST_SUB+= APACHE="@comment "
+PLIST_SUB+= CGI="@comment "
.endif
.if defined(WITH_APACHE)
-CONFIGURE_ARGS+= --enable-apache
-BUILD_DEPENDS+= curl.4:${PORTSDIR}/ftp/curl
-PLIST_SUB+= APACHE=""
+CONFIGURE_ARGS+=--enable-apache
+LIB_DEPENDS+= curl.4:${PORTSDIR}/ftp/curl
+PLIST_SUB+= APACHE=""
.else
-CONFIGURE_ARGS+= --disable-apache
-PLIST_SUB+= APACHE="@comment "
+CONFIGURE_ARGS+=--disable-apache
+PLIST_SUB+= APACHE="@comment "
.endif
.if defined(WITH_APCUPS)
-CONFIGURE_ARGS+= --enable-apcups
-BUILD_DEPENDS+= ${LOCALBASE}/sbin/apcupsd:${PORTSDIR}/sysutils/apcupsd
-PLIST_SUB+= APCUPS=""
+CONFIGURE_ARGS+=--enable-apcups
+BUILD_DEPENDS+= ${LOCALBASE}/sbin/apcupsd:${PORTSDIR}/sysutils/apcupsd
+PLIST_SUB+= APCUPS=""
.else
-CONFIGURE_ARGS+= --disable-apcups
-PLIST_SUB+= APCUPS="@comment "
+CONFIGURE_ARGS+=--disable-apcups
+PLIST_SUB+= APCUPS="@comment "
.endif
.if defined(WITH_INTERFACE)
-CONFIGURE_ARGS+= --enable-interface
-LIB_DEPENDS+= statgrab.8:${PORTSDIR}/devel/libstatgrab
-PLIST_SUB+= INTERFACE=""
+BUILD_DEPENDS+= pkg-config:${PORTSDIR}/devel/pkg-config
+CONFIGURE_ARGS+=--enable-interface
+LIB_DEPENDS+= statgrab.8:${PORTSDIR}/devel/libstatgrab
+PLIST_SUB+= INTERFACE=""
CONFIGURE_ENV+= LIBS="`pkg-config --libs libstatgrab`"
.else
-CONFIGURE_ARGS+= --disable-interface
-PLIST_SUB+= INTERFACE="@comment "
+CONFIGURE_ARGS+=--disable-interface
+PLIST_SUB+= INTERFACE="@comment "
.endif
.if defined(WITH_MBMON)
-CONFIGURE_ARGS+= --enable-mbmon
-RUN_DEPENDS+= ${LOCALBASE}/sbin/mbmond:${PORTSDIR}/sysutils/mbmon
-PLIST_SUB+= MBMON=""
+CONFIGURE_ARGS+=--enable-mbmon
+RUN_DEPENDS+= ${LOCALBASE}/sbin/mbmond:${PORTSDIR}/sysutils/mbmon
+PLIST_SUB+= MBMON=""
.else
-CONFIGURE_ARGS+= --disable-mbmon
-PLIST_SUB+= MBMON="@comment "
+CONFIGURE_ARGS+=--disable-mbmon
+PLIST_SUB+= MBMON="@comment "
.endif
.if defined(WITH_MYSQL)
-USE_MYSQL= yes
-CONFIGURE_ARGS+= --enable-mysql
-PLIST_SUB+= MYSQL=""
+USE_MYSQL= yes
+CONFIGURE_ARGS+=--enable-mysql
+PLIST_SUB+= MYSQL=""
.else
-CONFIGURE_ARGS+= --disable-mysql
-PLIST_SUB+= MYSQL="@comment "
+CONFIGURE_ARGS+=--disable-mysql
+PLIST_SUB+= MYSQL="@comment "
.endif
.if defined(WITH_PING)
-LIB_DEPENDS+= oping:${PORTSDIR}/net/liboping
-CONFIGURE_ARGS+= --enable-ping
-PLIST_SUB+= PING=""
+LIB_DEPENDS+= oping:${PORTSDIR}/net/liboping
+CONFIGURE_ARGS+=--enable-ping
+PLIST_SUB+= PING=""
.else
-CONFIGURE_ARGS+= --disable-ping
-PLIST_SUB+= PING="@comment "
+CONFIGURE_ARGS+=--disable-ping
+PLIST_SUB+= PING="@comment "
.endif
.if defined(WITH_RRDTOOL)
-LIB_DEPENDS+= rrd:${PORTSDIR}/databases/rrdtool
-CONFIGURE_ARGS+= --enable-rrdtool
-PLIST_SUB+= RRD=""
+LIB_DEPENDS+= rrd:${PORTSDIR}/databases/rrdtool
+CONFIGURE_ARGS+=--enable-rrdtool
+PLIST_SUB+= RRD=""
.else
-CONFIGURE_ARGS+= --disable-rrdtool
-PLIST_SUB+= RRD="@comment "
+CONFIGURE_ARGS+=--disable-rrdtool
+PLIST_SUB+= RRD="@comment "
.endif
.if defined(WITH_SNMP)
-LIB_DEPENDS+= netsnmp.16:${PORTSDIR}/net-mgmt/net-snmp
-CONFIGURE_ARGS+= --enable-snmp
-PLIST_SUB+= SNMP=""
+LIB_DEPENDS+= netsnmp.16:${PORTSDIR}/net-mgmt/net-snmp
+CONFIGURE_ARGS+=--enable-snmp
+PLIST_SUB+= SNMP=""
.else
-CONFIGURE_ARGS+= --disable-snmp
-PLIST_SUB+= SNMP="@comment "
+CONFIGURE_ARGS+=--disable-snmp
+PLIST_SUB+= SNMP="@comment "
.endif
.if defined(WITH_XMMS)
-LIB_DEPENDS+= xmms.4:${PORTSDIR}/multimedia/xmms
-CONFIGURE_ARGS+= --enable-xmms
-CFLAGS= `pkg-config glib --cflags`
-PLIST_SUB+= XMMS=""
+USE_GNOME+= _glib20
+LIB_DEPENDS+= xmms.4:${PORTSDIR}/multimedia/xmms
+CONFIGURE_ARGS+=--enable-xmms
+CFLAGS+= `pkg-config glib --cflags`
+PLIST_SUB+= XMMS=""
.else
-CONFIGURE_ARGS+= --disable-xmms
-PLIST_SUB+= XMMS="@comment "
+CONFIGURE_ARGS+=--disable-xmms
+PLIST_SUB+= XMMS="@comment "
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} \
+ -e 's;@prefix@/var/;/var/;' \
+ -e 's;/var/lib/;/var/db/;' \
+ ${WRKSRC}/src/collectd.conf.in
+ @${REINPLACE_CMD} \
+ -e 's;$$[(]DESTDIR)$$[(]sysconfdir)/collectd\.conf;&.sample;' \
+ ${WRKSRC}/src/Makefile.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
+
+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 defined(WITH_CGI)
+ ${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.post.mk>
diff --git a/net-mgmt/collectd/files/collectd.in b/net-mgmt/collectd/files/collectd.in
new file mode 100644
index 000000000000..5ec218f3b27e
--- /dev/null
+++ b/net-mgmt/collectd/files/collectd.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# PROVIDE: collectd
+# REQUIRE: LOGIN
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# collectd_enable (bool): Set to NO by default.
+# Set it to YES to enable collectd.
+# collectd_flags (string): Set to "" by default.
+# Additional flags to collecd, see manual page.
+#
+
+. %%RC_SUBR%%
+
+name="collectd"
+rcvar=${name}_enable
+
+command=%%PREFIX%%/sbin/${name}
+
+load_rc_config $name
+
+: ${collectd_enable="NO"}
+: ${collectd_flags=""}
+
+run_rc_command "$1"
diff --git a/net-mgmt/collectd/files/patch-src__collectd.h b/net-mgmt/collectd/files/patch-src__collectd.h
new file mode 100644
index 000000000000..8058189613b1
--- /dev/null
+++ b/net-mgmt/collectd/files/patch-src__collectd.h
@@ -0,0 +1,20 @@
+--- ./src/collectd.h.orig 2007-09-28 17:55:34.000000000 +0300
++++ ./src/collectd.h 2008-05-06 10:32:08.000000000 +0300
+@@ -183,7 +183,7 @@
+ #endif
+
+ #ifndef LOCALSTATEDIR
+-#define LOCALSTATEDIR PREFIX "/var"
++#define LOCALSTATEDIR "/var"
+ #endif
+
+ #ifndef PKGLOCALSTATEDIR
+@@ -191,7 +191,7 @@
+ #endif
+
+ #ifndef PIDFILE
+-#define PIDFILE PREFIX "/var/run/" PACKAGE_NAME ".pid"
++#define PIDFILE "/var/run/" PACKAGE_NAME ".pid"
+ #endif
+
+ #ifndef PLUGINDIR
diff --git a/net-mgmt/collectd/pkg-descr b/net-mgmt/collectd/pkg-descr
index b4c750a96be2..a591a0195caa 100644
--- a/net-mgmt/collectd/pkg-descr
+++ b/net-mgmt/collectd/pkg-descr
@@ -1,6 +1,6 @@
collectd is a small daemon written in C for performance. It reads various
system & network statistics along with updating output RRD or CSV files.
The daemon is very fast and allows for frequent polling of values, with
-support for polling as frequent as every 10 seconds.
+support for polling as frequent as every 10 seconds.
WWW: http://www.collectd.org/
diff --git a/net-mgmt/collectd/pkg-plist b/net-mgmt/collectd/pkg-plist
index 373023f5430f..2da1f6995781 100644
--- a/net-mgmt/collectd/pkg-plist
+++ b/net-mgmt/collectd/pkg-plist
@@ -1,5 +1,15 @@
+@stopdaemon collectd
+sbin/collectd
+@unexec if cmp -s %D/etc/collectd.conf.sample %D/etc/collectd.conf; then rm -f %D/etc/collectd.conf; fi
+etc/collectd.conf.sample
+@exec if [ ! -f %B/collectd.conf ] ; then cp -p %B/%f %B/collectd.conf; fi
+%%CGI%%%%WWWDIR%%/collection.cgi
+%%CGI%%@unexec if cmp -s %B/collection.conf.sample %B/collection.conf; then rm -f %B/collection.conf; fi
+%%CGI%%%%WWWDIR%%/collection.conf.sample
+%%CGI%%@exec if [ ! -f %B/collection.conf ] ; then cp -p %B/%f %B/collection.conf; fi
+%%CGI%%@dirrmtry %%WWWDIR%%
bin/collectd-nagios
-etc/collectd.conf
+lib/collectd/types.db
%%APACHE%%lib/collectd/apache.la
%%APACHE%%lib/collectd/apache.so
%%APCUPS%%lib/collectd/apcups.la
@@ -42,11 +52,10 @@ lib/collectd/swap.la
lib/collectd/swap.so
lib/collectd/syslog.la
lib/collectd/syslog.so
-lib/collectd/types.db
lib/collectd/unixsock.la
lib/collectd/unixsock.so
%%XMMS%%lib/collectd/xmms.la
%%XMMS%%lib/collectd/xmms.so
@dirrm lib/collectd
-sbin/collectd
-@dirrmtry var/lib/collectd
+@exec mkdir -p /var/db/collectd
+@unexec rmdir /var/db/collectd 2>/dev/null || true