View | Details | Raw Unified | Return to bug 152947
Collapse All | Expand All

(-)net-mgmt/collectd/Makefile (-4 / +22 lines)
Lines 13-27 Link Here
13
13
14
MAINTAINER=	ports@bsdserwis.com
14
MAINTAINER=	ports@bsdserwis.com
15
COMMENT=	Systems & network statistics collection daemon
15
COMMENT=	Systems & network statistics collection daemon
16
16
17
USE_GMAKE=	yes
17
USE_GMAKE=	yes
18
GNU_CONFIGURE=	yes
18
GNU_CONFIGURE=	yes
19
USE_AUTOTOOLS=	libltdl:22
19
USE_AUTOTOOLS=	autoheader:268 aclocal:111 libtool:22 libtoolize:22 automake:19 autoconf:268 libltdl:22
20
WANT_GNOME=	yes
20
WANT_GNOME=	yes
21
21
22
AUTOMAKE_ARGS=	--add-missing --copy
23
LIBTOOLIZE_ARGS= --ltdl --copy --force
24
ACLOCAL_ARGS=
25
22
OPTIONS=	CGI		"Install collection.cgi (requires RRDTOOL)" 	Off \
26
OPTIONS=	CGI		"Install collection.cgi (requires RRDTOOL)" 	Off \
23
		BIND		"Enable BIND 9.5+ statistics"			On  \
27
		BIND		"Enable BIND 9.5+ statistics"			On  \
24
		DEBUG		"Enable debugging" 				Off \
28
		DEBUG		"Enable debugging" 				Off \
25
		APACHE		"Input: Apache mod_status (libcurl)" 		Off \
29
		APACHE		"Input: Apache mod_status (libcurl)" 		Off \
26
		APCUPS		"Input: APC UPS (apcupsd)" 			Off \
30
		APCUPS		"Input: APC UPS (apcupsd)" 			Off \
27
		CURL		"Input: CURL generic web statistics" 		Off \
31
		CURL		"Input: CURL generic web statistics" 		Off \
Lines 33-46 Link Here
33
		NGINX		"Input: Nginx" 					Off \
37
		NGINX		"Input: Nginx" 					Off \
34
		OPENVPN		"Input: OpenVPN statistics"			Off \
38
		OPENVPN		"Input: OpenVPN statistics"			Off \
35
		PDNS		"Input: PowerDNS" 				Off \
39
		PDNS		"Input: PowerDNS" 				Off \
36
		PGSQL		"Input: PostgreSQL" 				Off \
40
		PGSQL		"Input: PostgreSQL" 				Off \
37
		PING		"Input: Network latency (liboping)" 		On  \
41
		PING		"Input: Network latency (liboping)" 		On  \
38
		SNMP		"Input: SNMP" 					On  \
42
		SNMP		"Input: SNMP" 					On  \
39
		XMMS		"Input: XMMS" 					Off \
43
		XMMS		"Input: XMMS" 					Off
40
		RRDTOOL		"Output: RRDTool" 				On
41
44
42
MAN1=		collectd.1 collectd-nagios.1 collectdmon.1
45
MAN1=		collectd.1 collectd-nagios.1 collectdmon.1
43
MAN5=		collectd.conf.5 collectd-email.5 collectd-exec.5 \
46
MAN5=		collectd.conf.5 collectd-email.5 collectd-exec.5 \
44
		collectd-snmp.5 collectd-unixsock.5 collectd-perl.5 \
47
		collectd-snmp.5 collectd-unixsock.5 collectd-perl.5 \
45
		collectd-java.5 collectd-python.5 types.db.5
48
		collectd-java.5 collectd-python.5 types.db.5
46
USE_RC_SUBR=	collectd collectdmon
49
USE_RC_SUBR=	collectd collectdmon
Lines 49-60 Link Here
49
52
50
CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
53
CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
51
		LDFLAGS="-L${LOCALBASE}/lib"
54
		LDFLAGS="-L${LOCALBASE}/lib"
52
55
53
.include <bsd.port.pre.mk>
56
.include <bsd.port.pre.mk>
54
57
58
.if ( ${OSVERSION} >= 800000 )
59
OPTIONS+=	ZFS_ARC		"Input: ZFS ARC"				Off
60
.else
61
.undef WITH_ZFS_ARC
62
.endif
63
64
OPTIONS+=	RRDTOOL		"Output: RRDTool" 				On
65
55
.if ( ${OSVERSION} < 601103 )
66
.if ( ${OSVERSION} < 601103 )
56
BROKEN=		Need bind9 import post 6.1
67
BROKEN=		Need bind9 import post 6.1
57
.endif
68
.endif
58
69
59
.if ${OSVERSION} < 700000
70
.if ${OSVERSION} < 700000
60
BROKEN=		does not configure on 6.X
71
BROKEN=		does not configure on 6.X
Lines 120-132 Link Here
120
		--disable-tokyotyrant \
131
		--disable-tokyotyrant \
121
		--disable-users \
132
		--disable-users \
122
		--disable-vmem \
133
		--disable-vmem \
123
		--disable-vserver \
134
		--disable-vserver \
124
		--disable-wireless \
135
		--disable-wireless \
125
		--disable-write_http \
136
		--disable-write_http \
126
		--disable-zfs_arc \
127
		--without-perl-bindings
137
		--without-perl-bindings
128
138
129
.if defined(WITH_DEBUG)
139
.if defined(WITH_DEBUG)
130
CONFIGURE_ARGS+=--enable-debug
140
CONFIGURE_ARGS+=--enable-debug
131
.endif
141
.endif
132
142
Lines 304-315 Link Here
304
PLIST_SUB+=	XMMS=""
314
PLIST_SUB+=	XMMS=""
305
.else
315
.else
306
CONFIGURE_ARGS+=--disable-xmms
316
CONFIGURE_ARGS+=--disable-xmms
307
PLIST_SUB+=	XMMS="@comment "
317
PLIST_SUB+=	XMMS="@comment "
308
.endif
318
.endif
309
319
320
.if defined(WITH_ZFS_ARC) && ( ${OSVERSION} >= 800000 )
321
CONFIGURE_ARGS+=--enable-zfs_arc
322
PLIST_SUB+=	ZFS_ARC=""
323
.else
324
CONFIGURE_ARGS+=--disable-zfs_arc
325
PLIST_SUB+=	ZFS_ARC="@comment "
326
.endif
327
310
post-patch:
328
post-patch:
311
	@${REINPLACE_CMD} \
329
	@${REINPLACE_CMD} \
312
		-e 's;@prefix@/var/;/var/;' \
330
		-e 's;@prefix@/var/;/var/;' \
313
		-e 's;/var/lib/;/var/db/;' \
331
		-e 's;/var/lib/;/var/db/;' \
314
		${WRKSRC}/src/collectd.conf.in
332
		${WRKSRC}/src/collectd.conf.in
315
	@${REINPLACE_CMD} \
333
	@${REINPLACE_CMD} \
(-)net-mgmt/collectd/files/patch-configure.in (+59 lines)
Line 0 Link Here
1
--- configure.in.idborig	2010-12-08 15:55:15.333847856 +1030
2
+++ configure.in	2010-12-08 15:59:28.307013465 +1030
3
@@ -63,6 +63,9 @@
4
 	*openbsd*)
5
 	ac_system="OpenBSD"
6
 	;;
7
+	*freebsd*)
8
+	ac_system="FreeBSD"
9
+	;;
10
 	*aix*)
11
 	AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
12
 	ac_system="AIX"
13
@@ -90,7 +93,7 @@
14
 fi
15
 
16
 # Where to install .pc files.
17
-pkgconfigdir="${libdir}/pkgconfig"
18
+pkgconfigdir="${prefix}/libdata/pkgconfig"
19
 AC_SUBST(pkgconfigdir)
20
 
21
 # Check for standards compliance mode
22
@@ -284,6 +287,24 @@
23
 	AC_MSG_RESULT([no])
24
 fi
25
 
26
+AC_MSG_CHECKING([for sysctl kstat.zfs])
27
+if test -x /sbin/sysctl
28
+then
29
+	/sbin/sysctl kstat.zfs 2>/dev/null
30
+	if test $? -eq 0
31
+	then
32
+		AC_MSG_RESULT([yes])
33
+		AC_DEFINE(HAVE_SYSCTL_KSTAT_ZFS, 1,
34
+		[Define if sysctl supports kstat.zfs])
35
+		have_sysctl_kstat_zfs="yes"
36
+	else
37
+		AC_MSG_RESULT([no])
38
+		have_sysctl_kstat_zfs="no"
39
+	fi
40
+else
41
+	AC_MSG_RESULT([no])
42
+fi
43
+
44
 # For hddtemp module
45
 AC_CHECK_HEADERS(linux/major.h libgen.h)
46
 
47
@@ -3968,6 +3989,12 @@
48
 	plugin_zfs_arc="yes"
49
 fi
50
 
51
+# FreeBSD with zfs.ko loaded
52
+if test "x$ac_system" = "xFreeBSD" -a "X$have_sysctl_kstat_zfs" = "Xyes"
53
+then
54
+	plugin_zfs_arc="yes"
55
+fi
56
+
57
 if test "x$with_devinfo$with_kstat" = "xyesyes"
58
 then
59
 	plugin_cpu="yes"
(-)net-mgmt/collectd/files/patch-src__Makefile.am (+24 lines)
Line 0 Link Here
1
--- src/Makefile.am.idborig	2010-12-08 16:00:22.720212550 +1030
2
+++ src/Makefile.am	2010-12-08 16:02:58.038149584 +1030
3
@@ -1158,7 +1158,9 @@
4
 zfs_arc_la_SOURCES = zfs_arc.c
5
 zfs_arc_la_CFLAGS = $(AM_CFLAGS)
6
 zfs_arc_la_LDFLAGS = -module -avoid-version
7
+if BUILD_WITH_LIBKSTAT
8
 zfs_arc_la_LIBADD = -lkstat
9
+endif
10
 collectd_LDADD += "-dlopen" zfs_arc.la
11
 collectd_DEPENDENCIES += zfs_arc.la
12
 endif
13
@@ -1215,9 +1217,9 @@
14
 	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
15
 	if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
16
 	then \
17
-		$(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf.pkg-orig; \
18
+		 $(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf.sample.pkg-orig; \
19
 	else \
20
-		$(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
21
+		$(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf.sample; \
22
 	fi; \
23
 	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
24
 	$(INSTALL) -m 0644 $(srcdir)/types.db $(DESTDIR)$(pkgdatadir)/types.db;
(-)net-mgmt/collectd/files/patch-src__zfs_arc.c (+100 lines)
Line 0 Link Here
1
--- src/zfs_arc.c.idborig	2010-12-08 16:04:08.946558865 +1030
2
+++ src/zfs_arc.c	2010-12-08 16:05:23.979254992 +1030
3
@@ -26,8 +26,12 @@
4
 /*
5
  * Global variables
6
  */
7
+#if HAVE_LIBKSTAT
8
 static kstat_t *ksp;
9
 extern kstat_ctl_t *kc;
10
+#elif HAVE_SYSCTL
11
+#include <sys/sysctl.h>
12
+#endif
13
 
14
 static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
15
 {
16
@@ -88,6 +92,19 @@
17
 	za_submit ("arc_counts", type_instance, values, STATIC_ARRAY_SIZE(values));
18
 }
19
 
20
+#if HAVE_SYSCTL
21
+static uint64_t za_sysctl_read_stat (const char* stat)
22
+{
23
+	uint64_t sysctl_stat;
24
+	size_t stat_size = sizeof(sysctl_stat);
25
+
26
+	if (sysctlbyname(stat, &sysctl_stat, &stat_size, NULL, 0) == 0) {
27
+		return (sysctl_stat);
28
+	}
29
+	return(0);
30
+}
31
+#endif
32
+
33
 static int za_read (void)
34
 {
35
 	gauge_t   arcsize, targetsize, minlimit, maxlimit, hits, misses, l2_size, l2_hits, l2_misses;
36
@@ -95,6 +112,7 @@
37
 	counter_t demand_data_misses, demand_metadata_misses, prefetch_data_misses, prefetch_metadata_misses;
38
 	counter_t l2_read_bytes, l2_write_bytes;
39
 
40
+#if HAVE_LIBKSTAT
41
 	get_kstat (&ksp, "zfs", 0, "arcstats");
42
 	if (ksp == NULL)
43
 	{
44
@@ -125,6 +143,31 @@
45
 	l2_write_bytes = get_kstat_value(ksp, "l2_write_bytes");
46
 	l2_hits        = get_kstat_value(ksp, "l2_hits");
47
 	l2_misses      = get_kstat_value(ksp, "l2_misses");
48
+#elif HAVE_SYSCTL
49
+	arcsize    = za_sysctl_read_stat("kstat.zfs.misc.arcstats.size");
50
+	targetsize = za_sysctl_read_stat("kstat.zfs.misc.arcstats.c");
51
+	minlimit   = za_sysctl_read_stat("kstat.zfs.misc.arcstats.c_min");
52
+	maxlimit   = za_sysctl_read_stat("kstat.zfs.misc.arcstats.c_max");
53
+
54
+	demand_data_hits       = za_sysctl_read_stat("kstat.zfs.misc.arcstats.demand_data_hits");
55
+	demand_metadata_hits   = za_sysctl_read_stat("kstat.zfs.misc.arcstats.demand_metadata_hits");
56
+	prefetch_data_hits     = za_sysctl_read_stat("kstat.zfs.misc.arcstats.prefetch_data_hits");
57
+	prefetch_metadata_hits = za_sysctl_read_stat("kstat.zfs.misc.arcstats.prefetch_metadata_hits");
58
+
59
+	demand_data_misses       = za_sysctl_read_stat("kstat.zfs.misc.arcstats.demand_data_misses");
60
+	demand_metadata_misses   = za_sysctl_read_stat("kstat.zfs.misc.arcstats.demand_metadata_misses");
61
+	prefetch_data_misses     = za_sysctl_read_stat("kstat.zfs.misc.arcstats.prefetch_data_misses");
62
+	prefetch_metadata_misses = za_sysctl_read_stat("kstat.zfs.misc.arcstats.prefetch_metadata_misses");
63
+
64
+	hits   = za_sysctl_read_stat("kstat.zfs.misc.arcstats.hits");
65
+	misses = za_sysctl_read_stat("kstat.zfs.misc.arcstats.misses");
66
+
67
+	l2_size        = za_sysctl_read_stat("kstat.zfs.misc.arcstats.l2_size");
68
+	l2_read_bytes  = za_sysctl_read_stat("kstat.zfs.misc.arcstats.l2_read_bytes");
69
+	l2_write_bytes = za_sysctl_read_stat("kstat.zfs.misc.arcstats.l2_write_bytes");
70
+	l2_hits        = za_sysctl_read_stat("kstat.zfs.misc.arcstats.l2_hits");
71
+	l2_misses      = za_sysctl_read_stat("kstat.zfs.misc.arcstats.l2_misses");
72
+#endif
73
 
74
 
75
 	za_submit_size (arcsize, targetsize, minlimit, maxlimit);
76
@@ -145,6 +188,7 @@
77
 
78
 static int za_init (void) /* {{{ */
79
 {
80
+#if HAVE_LIBKSTAT
81
 	ksp = NULL;
82
 
83
 	/* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */
84
@@ -153,6 +197,16 @@
85
 		ERROR ("zfs_arc plugin: kstat chain control structure not available.");
86
 		return (-1);
87
 	}
88
+#elif HAVE_SYSCTL
89
+	uint64_t arcsize = 0;
90
+	size_t arcsize_size = sizeof (arcsize);
91
+
92
+	if (sysctlbyname ("kstat.zfs.misc.arcstats.size", &arcsize, &arcsize_size, NULL, 0) < 0)
93
+	{
94
+		ERROR ("zfs_arc plugin: sysctl kstat.zfs.misc.arcstats structure not available.");
95
+		return (-1);
96
+	}
97
+#endif
98
 
99
 	return (0);
100
 } /* }}} int za_init */
(-)net-mgmt/collectd/pkg-plist (+3 lines)
Lines 128-139 Link Here
128
include/collectd/client.h
128
include/collectd/client.h
129
include/collectd/lcc_features.h
129
include/collectd/lcc_features.h
130
libdata/pkgconfig/libcollectdclient.pc
130
libdata/pkgconfig/libcollectdclient.pc
131
%%XMMS%%lib/collectd/xmms.a
131
%%XMMS%%lib/collectd/xmms.a
132
%%XMMS%%lib/collectd/xmms.la
132
%%XMMS%%lib/collectd/xmms.la
133
%%XMMS%%lib/collectd/xmms.so
133
%%XMMS%%lib/collectd/xmms.so
134
%%ZFS_ARC%%lib/collectd/zfs_arc.a
135
%%ZFS_ARC%%lib/collectd/zfs_arc.la
136
%%ZFS_ARC%%lib/collectd/zfs_arc.so
134
%%DATADIR%%/postgresql_default.conf
137
%%DATADIR%%/postgresql_default.conf
135
%%DATADIR%%/types.db
138
%%DATADIR%%/types.db
136
@dirrm lib/collectd
139
@dirrm lib/collectd
137
@dirrm include/collectd
140
@dirrm include/collectd
138
@dirrm %%DATADIR%%
141
@dirrm %%DATADIR%%
139
@exec mkdir -p /var/db/collectd
142
@exec mkdir -p /var/db/collectd

Return to bug 152947