View | Details | Raw Unified | Return to bug 176691 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-3 / +3 lines)
Lines 1-14 Link Here
1
# Created by: Matt Peterson <matt@peterson.org>
1
# Created by: Matt Peterson <matt@peterson.org>
2
# $FreeBSD$
2
# $FreeBSD$
3
PORTNAME=	collectd
3
PORTNAME=	collectd
4
PORTVERSION=	5.1.0
4
PORTVERSION=	5.2.1
5
PORTREVISION=	5
6
CATEGORIES=	net-mgmt
5
CATEGORIES=	net-mgmt
7
MASTER_SITES=	http://collectd.org/files/
6
MASTER_SITES=	http://collectd.org/files/
8
7
9
MAINTAINER=	ports@bsdserwis.com
8
MAINTAINER=	ports@bsdserwis.com
10
COMMENT=	Systems & network statistics collection daemon
9
COMMENT=	Systems & network statistics collection daemon
11
10
11
USE_BZIP2=	yes
12
USE_GMAKE=	yes
12
USE_GMAKE=	yes
13
GNU_CONFIGURE=	yes
13
GNU_CONFIGURE=	yes
14
USE_AUTOTOOLS=	autoconf autoheader automake libltdl
14
USE_AUTOTOOLS=	autoconf autoheader automake libltdl
Lines 64-70 Link Here
64
WRITE_GRAPHITE_DESC=	write_graphite
64
WRITE_GRAPHITE_DESC=	write_graphite
65
WRITE_HTTP_DESC=	write_http
65
WRITE_HTTP_DESC=	write_http
66
66
67
MAN1=		collectd.1 collectd-nagios.1 collectdmon.1 collectdctl.1
67
MAN1=		collectd.1 collectd-nagios.1 collectd-tg.1 collectdmon.1 collectdctl.1
68
MAN5=		collectd.conf.5 collectd-email.5 collectd-exec.5 \
68
MAN5=		collectd.conf.5 collectd-email.5 collectd-exec.5 \
69
		collectd-snmp.5 collectd-unixsock.5 collectd-perl.5 \
69
		collectd-snmp.5 collectd-unixsock.5 collectd-perl.5 \
70
		collectd-java.5 collectd-python.5 types.db.5 collectd-threshold.5
70
		collectd-java.5 collectd-python.5 types.db.5 collectd-threshold.5
(-)distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (collectd-5.1.0.tar.gz) = 8e06c03c5467f3021565570fc86c931a43579aa6dad25ca5999d66850cd19927
1
SHA256 (collectd-5.2.1.tar.bz2) = d82a5c302d2cfa0c3f7a3c7b7e37fb3faf42b17d2addae036cb819b6b25b9d98
2
SIZE (collectd-5.1.0.tar.gz) = 1630323
2
SIZE (collectd-5.2.1.tar.bz2) = 1395740
(-)files/patch-configure.in (-15 / +15 lines)
Lines 1-6 Link Here
1
--- configure.in.orig	2012-04-02 08:04:58.000000000 +0000
1
diff --git configure.in configure.in
2
+++ configure.in	2012-11-23 22:00:22.424129087 +0000
2
index d50e802..4660787 100644
3
@@ -67,6 +67,9 @@
3
--- configure.in
4
+++ configure.in
5
@@ -67,6 +67,9 @@ case $host_os in
4
 	*openbsd*)
6
 	*openbsd*)
5
 	ac_system="OpenBSD"
7
 	ac_system="OpenBSD"
6
 	;;
8
 	;;
Lines 10-16 Link Here
10
 	*aix*)
12
 	*aix*)
11
 	AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
13
 	AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
12
 	ac_system="AIX"
14
 	ac_system="AIX"
13
@@ -98,7 +101,7 @@
15
@@ -99,7 +102,7 @@ then
14
 fi
16
 fi
15
 
17
 
16
 # Where to install .pc files.
18
 # Where to install .pc files.
Lines 19-25 Link Here
19
 AC_SUBST(pkgconfigdir)
21
 AC_SUBST(pkgconfigdir)
20
 
22
 
21
 # Check for standards compliance mode
23
 # Check for standards compliance mode
22
@@ -1378,6 +1381,7 @@
24
@@ -1386,6 +1389,7 @@ if test "x$with_kstat" = "xyes"
23
 then
25
 then
24
 	AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
26
 	AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
25
 fi
27
 fi
Lines 27-33 Link Here
27
 if test "x$with_kstat" = "xyes"
29
 if test "x$with_kstat" = "xyes"
28
 then
30
 then
29
 	AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
31
 	AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
30
@@ -1387,6 +1391,8 @@
32
@@ -1395,6 +1399,8 @@ if test "x$with_kstat" = "xyes"
31
 then
33
 then
32
 	AC_DEFINE(HAVE_LIBKSTAT, 1,
34
 	AC_DEFINE(HAVE_LIBKSTAT, 1,
33
 		  [Define to 1 if you have the 'kstat' library (-lkstat)])
35
 		  [Define to 1 if you have the 'kstat' library (-lkstat)])
Lines 36-42 Link Here
36
 fi
38
 fi
37
 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
39
 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
38
 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
40
 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
39
@@ -1807,9 +1813,6 @@
41
@@ -1815,9 +1821,6 @@ then
40
 		[with_libgcrypt="yes"],
42
 		[with_libgcrypt="yes"],
41
 		[with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
43
 		[with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
42
 
44
 
Lines 46-52 Link Here
46
 fi
48
 fi
47
 
49
 
48
 CPPFLAGS="$SAVE_CPPFLAGS"
50
 CPPFLAGS="$SAVE_CPPFLAGS"
49
@@ -3297,7 +3300,7 @@
51
@@ -3376,7 +3379,7 @@ fi
50
 if test "x$with_python" = "xyes"
52
 if test "x$with_python" = "xyes"
51
 then
53
 then
52
 	AC_MSG_CHECKING([for Python LIBS])
54
 	AC_MSG_CHECKING([for Python LIBS])
Lines 55-61 Link Here
55
 	python_config_status=$?
57
 	python_config_status=$?
56
 
58
 
57
 	if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
59
 	if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
58
@@ -3312,7 +3315,7 @@
60
@@ -3391,7 +3394,7 @@ fi
59
 if test "x$with_python" = "xyes"
61
 if test "x$with_python" = "xyes"
60
 then
62
 then
61
 	LDFLAGS="-L$python_library_path $LDFLAGS"
63
 	LDFLAGS="-L$python_library_path $LDFLAGS"
Lines 64-81 Link Here
64
 
66
 
65
 	AC_CHECK_FUNC(PyObject_CallFunction,
67
 	AC_CHECK_FUNC(PyObject_CallFunction,
66
 		      [with_python="yes"],
68
 		      [with_python="yes"],
67
--- configure.in.orig	2013-01-03 17:07:22.000000000 +0000
69
@@ -4136,7 +4139,7 @@ AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Pat
68
+++ configure.in	2013-01-03 17:07:58.000000000 +0000
69
@@ -4057,7 +4057,7 @@
70
 	then
70
 	then
71
 		AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
71
 		AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
72
 		with_libvarnish_cflags="-I$withval/include"
72
 		with_libvarnish_cflags="-I$withval/include"
73
-		with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
73
-		with_libvarnish_libs="-L$withval/lib -lvarnishapi"
74
+		with_libvarnish_libs="-L$withval/lib/varnish -lvarnish -lvarnishcompat -lvarnishapi"
74
+		with_libvarnish_libs="-L$withval/lib/varnish -lvarnishapi"
75
 		with_libvarnish="yes"
75
 		with_libvarnish="yes"
76
 	fi; fi; fi
76
 	fi; fi; fi
77
 ],
77
 ],
78
@@ -4580,6 +4583,12 @@
78
@@ -4661,6 +4664,12 @@ then
79
 	plugin_zfs_arc="yes"
79
 	plugin_zfs_arc="yes"
80
 fi
80
 fi
81
 
81
 
(-)files/patch-src__dns.c (-7 / +9 lines)
Lines 1-6 Link Here
1
--- src/dns.c.orig	2008-09-05 15:26:02.000000000 +0000
1
diff --git src/dns.c src/dns.c
2
+++ src/dns.c	2008-09-05 15:25:55.000000000 +0000
2
index fe3b672..0c43985 100644
3
@@ -210,6 +210,15 @@
3
--- src/dns.c
4
+++ src/dns.c
5
@@ -223,6 +223,15 @@ static void *dns_child_loop (__attribute__((unused)) void *dummy)
4
 		pthread_sigmask (SIG_SETMASK, &sigmask, NULL);
6
 		pthread_sigmask (SIG_SETMASK, &sigmask, NULL);
5
 	}
7
 	}
6
 
8
 
Lines 8-18 Link Here
8
+#ifdef __sparc64__
10
+#ifdef __sparc64__
9
+	if (pcap_device == NULL)
11
+	if (pcap_device == NULL)
10
+	{
12
+	{
11
+	    ERROR ("dns plugin: Interface required");
13
+		ERROR ("dns plugin: Interface required");
12
+	    return (NULL);
14
+		return (NULL);
13
+	}
15
+	}
14
+#endif
16
+#endif
15
+
17
+
16
 	/* Passing `pcap_device == NULL' is okay and the same as passign "any" */
18
 	/* Passing `pcap_device == NULL' is okay and the same as passign "any" */
17
 	DEBUG ("Creating PCAP object..");
19
 	DEBUG ("dns plugin: Creating PCAP object..");
18
 	pcap_obj = pcap_open_live (pcap_device,
20
 	pcap_obj = pcap_open_live ((pcap_device != NULL) ? pcap_device : "any",
(-)files/patch-src__zfs_arc.c (-192 / +197 lines)
Lines 1-232 Link Here
1
--- src/zfs_arc.c.orig	2012-04-02 08:04:58.000000000 +0000
1
diff --git configure.in configure.in
2
+++ src/zfs_arc.c	2012-11-24 17:54:21.715129054 +0000
2
index 4660787..54fd9d8 100644
3
@@ -25,11 +25,57 @@
3
--- configure.in
4
 #include "common.h"
4
+++ configure.in
5
 #include "plugin.h"
5
@@ -4843,6 +4843,12 @@ then
6
 	plugin_users="yes"
7
 fi
6
 
8
 
7
+#if !defined(HAVE_LIBKSTAT) && defined(HAVE_SYSCTLBYNAME)
9
+# FreeBSD
8
+#include <sys/sysctl.h>
10
+if test "x$have_struct_kinfo_proc_freebsd" = "xyes"
9
+#endif
11
+then
12
+	plugin_zfs_arc="yes"
13
+fi
10
+
14
+
11
 /*
15
 m4_divert_once([HELP_ENABLE], [
16
 collectd plugins:])
17
 
18
diff --git src/zfs_arc.c src/zfs_arc.c
19
index aa90019..17e8513 100644
20
--- src/zfs_arc.c
21
+++ src/zfs_arc.c
22
@@ -19,6 +19,8 @@
23
  * Authors:
24
  *   Anthony Dewhurst <dewhurst at gmail>
25
  *   Aurelien Rougemont <beorn at gandi.net>
26
+ *   Brad Davis <brd at FreeBSD.org>
27
+ *   William Grzybowski <william88 at gmail>
28
  **/
29
 
30
 #include "collectd.h"
31
@@ -29,7 +31,14 @@
12
  * Global variables
32
  * Global variables
13
  */
33
  */
14
-static kstat_t *ksp;
34
 
15
+#if defined(HAVE_LIBKSTAT)
35
+#if defined(HAVE_LIBKSTAT)
36
+static kstat_t *ksp;
16
 extern kstat_ctl_t *kc;
37
 extern kstat_ctl_t *kc;
17
+#endif
38
+#elif defined(HAVE_SYSCTLBYNAME)
39
+  typedef void kstat_t;
40
+# include <sys/types.h>
41
+# include <sys/sysctl.h>
42
+#endif /* HAVE_SYSCTLBYNAME */
43
 
44
 static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
45
 {
46
@@ -57,37 +66,56 @@ static void za_submit_gauge (const char* type, const char* type_instance, gauge_
47
 static int za_read_derive (kstat_t *ksp, const char *kstat_value,
48
     const char *type, const char *type_instance)
49
 {
50
-  long long tmp;
51
-  value_t v;
52
-
53
-  tmp = get_kstat_value (ksp, (char *)kstat_value);
54
-  if (tmp == -1LL)
55
-  {
56
-    ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
57
-    return (-1);
58
-  }
59
-
60
-  v.derive = (derive_t) tmp;
61
-  za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
62
-  return (0);
63
+	long long tmp;
64
+	value_t v;
18
+
65
+
19
+/*
20
+ * Context
21
+ */
22
+struct za_context {
23
+#if defined(HAVE_LIBKSTAT)
66
+#if defined(HAVE_LIBKSTAT)
24
+    kstat_t *ksp;
67
+	tmp = get_kstat_value (ksp, (char *)kstat_value);
25
+#endif
68
+	if (tmp == -1LL)
26
+};
27
+
28
+static int za_init_context(struct za_context *ctx)
29
+{
30
+#if defined(HAVE_LIBKSTAT)
31
+	get_kstat (&ctx->ksp, "zfs", 0, "arcstats");
32
+	if (ctx->ksp == NULL)
33
+	{
69
+	{
34
+		ERROR ("zfs_arc plugin: Cannot find zfs:0:arcstats kstat.");
70
+		ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
35
+		return (-1);
71
+		return (-1);
36
+	}
72
+	}
37
+#endif
38
+	return 0;
39
+}
40
+
41
+static long long za_get_value(struct za_context *ctx, const char* name)
42
+{
43
+#if defined(HAVE_LIBKSTAT)
44
+	return get_kstat_value(ctx->ksp, name);
45
+#elif defined(HAVE_SYSCTLBYNAME)
73
+#elif defined(HAVE_SYSCTLBYNAME)
46
+	// kstat values are available on FreeBSD through sysctl
74
+	size_t size;
47
+	char fullname[512];
75
+	size = sizeof(tmp);
48
+	long long result = 0;
76
+	if (sysctlbyname(kstat_value, &tmp, &size, NULL, 0) < 0) {
49
+	size_t size = sizeof(result);
77
+		ERROR ("zfs_arc plugin: Reading sysctl \"%s\" failed.", kstat_value);
50
+	ssnprintf(fullname, sizeof(fullname), "kstat.zfs.misc.arcstats.%s", name);
78
+		return (-1);
51
+	if (sysctlbyname(fullname, &result, &size, NULL, 0) != 0 || size != sizeof(result))
52
+	{
53
+		ERROR ("zfs_arc plugin: Cannot find stats using sysctl");
54
+		result = 0;
55
+	}
79
+	}
56
+	return result;
80
+#endif /* HAVE_LIBKSTAT */
57
+#endif
81
+
58
+}
82
+	v.derive = (derive_t) tmp;
59
 
83
+	za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
60
 static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
84
+	return (0);
61
 {
62
@@ -54,13 +100,13 @@
63
 	za_submit (type, type_instance, &vv, 1);
64
 }
85
 }
65
 
86
 
66
-static int za_read_derive (kstat_t *ksp, const char *kstat_value,
87
 static int za_read_gauge (kstat_t *ksp, const char *kstat_value,
67
+static int za_read_derive (struct za_context *ctx, const char *kstat_value,
68
     const char *type, const char *type_instance)
88
     const char *type, const char *type_instance)
69
 {
89
 {
70
   long long tmp;
90
-  long long tmp;
71
   value_t v;
91
-  value_t v;
72
 
92
-
73
-  tmp = get_kstat_value (ksp, kstat_value);
93
-  tmp = get_kstat_value (ksp, (char *)kstat_value);
74
+  tmp = za_get_value (ctx, (char *)kstat_value);
94
-  if (tmp == -1LL)
75
   if (tmp == -1LL)
95
-  {
76
   {
96
-    ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
77
     ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
97
-    return (-1);
78
@@ -69,15 +115,16 @@
98
-  }
79
 
99
-
80
   v.derive = (derive_t) tmp;
100
-  v.gauge = (gauge_t) tmp;
81
   za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
101
-  za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
82
+  return (0);
102
-  return (0);
103
+	long long tmp;
104
+	value_t v;
105
+
106
+#if defined(HAVE_LIBKSTAT)
107
+	tmp = get_kstat_value (ksp, (char *)kstat_value);
108
+	if (tmp == -1LL)
109
+	{
110
+		ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
111
+		return (-1);
112
+	}
113
+
114
+#elif defined(HAVE_SYSCTLBYNAME)
115
+	size_t size;
116
+	size = sizeof(tmp);
117
+	if (sysctlbyname(kstat_value, &tmp, &size, NULL, 0) < 0) {
118
+		ERROR ("zfs_arc plugin: Reading sysctl \"%s\" failed.", kstat_value);
119
+		return (-1);
120
+	}
121
+#endif /* HAVE_LIBKSTAT */
122
+
123
+	v.gauge = (gauge_t) tmp;
124
+	za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
125
+	return (0);
83
 }
126
 }
84
 
127
 
85
-static int za_read_gauge (kstat_t *ksp, const char *kstat_value,
128
 static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t misses)
86
+static int za_read_gauge (struct za_context *ctx, const char *kstat_value,
129
@@ -105,11 +133,67 @@ static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t mi
87
     const char *type, const char *type_instance)
130
 	za_submit_gauge ("cache_ratio", type_instance, ratio);
88
 {
89
   long long tmp;
90
   value_t v;
91
 
92
-  tmp = get_kstat_value (ksp, kstat_value);
93
+  tmp = za_get_value (ctx, (char *)kstat_value);
94
   if (tmp == -1LL)
95
   {
96
     ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
97
@@ -86,18 +133,14 @@
98
 
99
   v.gauge = (gauge_t) tmp;
100
   za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
101
+  return (0);
102
 }
131
 }
103
 
132
 
104
-static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t misses)
133
-static int za_read (void)
105
+static void za_submit_ratio (const char* type_instance, long long hits, long long misses)
134
+#if defined(HAVE_SYSCTLBYNAME)
106
 {
135
+static int za_read_freebsd (void)
107
 	gauge_t ratio = NAN;
136
+{
108
 
137
+	// Sizes
109
-	if (!isfinite (hits) || (hits < 0.0))
138
+	za_read_gauge (NULL, "kstat.zfs.misc.arcstats.size", "cache_size", "arc");
110
-		hits = 0.0;
139
+	za_read_gauge (NULL, "kstat.zfs.misc.arcstats.l2_size", "cache_size", "L2");
111
-	if (!isfinite (misses) || (misses < 0.0))
140
+
112
-		misses = 0.0;
113
-
114
-	if ((hits != 0.0) || (misses != 0.0))
115
+	if ((hits > 0) || (misses > 0))
116
 		ratio = hits / (hits + misses);
117
 
118
 	za_submit_gauge ("cache_ratio", type_instance, ratio);
119
@@ -105,56 +148,55 @@
120
 
121
 static int za_read (void)
122
 {
123
-	gauge_t  arc_hits, arc_misses, l2_hits, l2_misses;
124
+	long long  arc_hits, arc_misses, l2_hits, l2_misses;
125
 	value_t  l2_io[2];
126
+	struct za_context ctx;
127
 
128
-	get_kstat (&ksp, "zfs", 0, "arcstats");
129
-	if (ksp == NULL)
130
+	if (za_init_context (&ctx) < 0)
131
 	{
132
-		ERROR ("zfs_arc plugin: Cannot find zfs:0:arcstats kstat.");
133
 		return (-1);
134
 	}
135
 
136
 	/* Sizes */
137
-	za_read_gauge (ksp, "size",    "cache_size", "arc");
138
-	za_read_gauge (ksp, "l2_size", "cache_size", "L2");
139
+	za_read_gauge (&ctx, "size",    "cache_size", "arc");
140
+	za_read_gauge (&ctx, "l2_size", "cache_size", "L2");
141
 
142
-        /* Operations */
143
-	za_read_derive (ksp, "allocated","cache_operation", "allocated");
144
-	za_read_derive (ksp, "deleted",  "cache_operation", "deleted");
145
-	za_read_derive (ksp, "stolen",   "cache_operation", "stolen");
146
-
147
-        /* Issue indicators */
148
-        za_read_derive (ksp, "mutex_miss", "mutex_operation", "miss");
149
-	za_read_derive (ksp, "hash_collisions", "hash_collisions", "");
150
+	/* Operations */
141
+	/* Operations */
151
+	za_read_derive (&ctx, "allocated","cache_operation", "allocated");
142
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.allocated", "cache_operation", "allocated");
152
+	za_read_derive (&ctx, "deleted",  "cache_operation", "deleted");
143
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.deleted",   "cache_operation", "deleted");
153
+	za_read_derive (&ctx, "stolen",   "cache_operation", "stolen");
144
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.stolen",    "cache_operation", "stolen");
154
+
145
+
155
+	/* Issue indicators */
146
+	/* Issue indicators */
156
+	za_read_derive (&ctx, "mutex_miss", "mutex_operation", "miss");
147
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.mutex_miss",      "mutex_operation", "miss");
157
+	za_read_derive (&ctx, "hash_collisions", "hash_collisions", "");
148
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.hash_collisions", "hash_collisions", "");
158
 	
149
+
159
-        /* Evictions */
160
-	za_read_derive (ksp, "evict_l2_cached",     "cache_eviction", "cached");
161
-	za_read_derive (ksp, "evict_l2_eligible",   "cache_eviction", "eligible");
162
-	za_read_derive (ksp, "evict_l2_ineligible", "cache_eviction", "ineligible");
163
+	/* Evictions */
150
+	/* Evictions */
164
+	za_read_derive (&ctx, "evict_l2_cached",     "cache_eviction", "cached");
151
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.evict_l2_cached",     "cache_eviction", "cached");
165
+	za_read_derive (&ctx, "evict_l2_eligible",   "cache_eviction", "eligible");
152
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.evict_l2_eligible",   "cache_eviction", "eligible");
166
+	za_read_derive (&ctx, "evict_l2_ineligible", "cache_eviction", "ineligible");
153
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.evict_l2_ineligible", "cache_eviction", "ineligible");
154
+
155
+	/* Hits / misses */
156
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_data_hits",         "cache_result", "demand_data-hit");
157
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_metadata_hits",     "cache_result", "demand_metadata-hit");
158
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_data_hits",       "cache_result", "prefetch_data-hit");
159
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_metadata_hits",   "cache_result", "prefetch_metadata-hit");
160
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_data_misses",       "cache_result", "demand_data-miss");
161
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_metadata_misses",   "cache_result", "demand_metadata-miss");
162
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_data_misses",     "cache_result", "prefetch_data-miss");
163
+	za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss");
164
+
165
+	/* Ratios */
166
+	gauge_t arc_hits;
167
+	gauge_t arc_misses;
168
+	gauge_t l2_hits;
169
+	gauge_t l2_misses;
170
+	value_t  l2_io[2];
171
+
172
+	size_t size;
173
+	size = sizeof(arc_hits);
174
+	sysctlbyname("kstat.zfs.misc.arcstats.hits", &arc_hits, &size, NULL, 0);
175
+	sysctlbyname("kstat.zfs.misc.arcstats.misses", &arc_misses, &size, NULL, 0);
176
+	sysctlbyname("kstat.zfs.misc.arcstats.l2_hits", &l2_hits, &size, NULL, 0);
177
+	sysctlbyname("kstat.zfs.misc.arcstats.l2_misses", &l2_misses, &size, NULL, 0);
178
+
179
+	za_submit_ratio ("arc", arc_hits, arc_misses);
180
+	za_submit_ratio ("L2", l2_hits, l2_misses);
181
+
182
+	/* I/O */
183
+	sysctlbyname("kstat.zfs.misc.arcstats.l2_read_bytes", &l2_io[0].derive, &size, NULL, 0);
184
+	sysctlbyname("kstat.zfs.misc.arcstats.l2_write_bytes", &l2_io[1].derive, &size, NULL, 0);
185
+
186
+	za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
187
+
188
+	return (0);
189
+}
190
+#elif defined(HAVE_LIBKSTAT)
191
+static int za_read_solaris (void)
192
 {
193
 	gauge_t  arc_hits, arc_misses, l2_hits, l2_misses;
194
 	value_t  l2_io[2];
195
-	kstat_t	 *ksp	= NULL;
167
 
196
 
168
 	/* Hits / misses */
197
 	get_kstat (&ksp, "zfs", 0, "arcstats");
169
-	za_read_derive (ksp, "demand_data_hits",         "cache_result", "demand_data-hit");
198
 	if (ksp == NULL)
170
-	za_read_derive (ksp, "demand_metadata_hits",     "cache_result", "demand_metadata-hit");
199
@@ -163,15 +247,20 @@ static int za_read (void)
171
-	za_read_derive (ksp, "prefetch_data_hits",       "cache_result", "prefetch_data-hit");
172
-	za_read_derive (ksp, "prefetch_metadata_hits",   "cache_result", "prefetch_metadata-hit");
173
-	za_read_derive (ksp, "demand_data_misses",       "cache_result", "demand_data-miss");
174
-	za_read_derive (ksp, "demand_metadata_misses",   "cache_result", "demand_metadata-miss");
175
-	za_read_derive (ksp, "prefetch_data_misses",     "cache_result", "prefetch_data-miss");
176
-	za_read_derive (ksp, "prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss");
177
+	za_read_derive (&ctx, "demand_data_hits",         "cache_result", "demand_data-hit");
178
+	za_read_derive (&ctx, "demand_metadata_hits",     "cache_result", "demand_metadata-hit");
179
+	za_read_derive (&ctx, "prefetch_data_hits",       "cache_result", "prefetch_data-hit");
180
+	za_read_derive (&ctx, "prefetch_metadata_hits",   "cache_result", "prefetch_metadata-hit");
181
+	za_read_derive (&ctx, "demand_data_misses",       "cache_result", "demand_data-miss");
182
+	za_read_derive (&ctx, "demand_metadata_misses",   "cache_result", "demand_metadata-miss");
183
+	za_read_derive (&ctx, "prefetch_data_misses",     "cache_result", "prefetch_data-miss");
184
+	za_read_derive (&ctx, "prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss");
185
 
200
 
186
 	/* Ratios */
201
 	return (0);
187
-	arc_hits   = (gauge_t) get_kstat_value(ksp, "hits");
202
 } /* int za_read */
188
-	arc_misses = (gauge_t) get_kstat_value(ksp, "misses");
203
+#endif
189
-	l2_hits    = (gauge_t) get_kstat_value(ksp, "l2_hits");
190
-	l2_misses  = (gauge_t) get_kstat_value(ksp, "l2_misses");
191
+	arc_hits   = za_get_value (&ctx, "hits");
192
+	arc_misses = za_get_value (&ctx, "misses");
193
+	l2_hits    = za_get_value (&ctx, "l2_hits");
194
+	l2_misses  = za_get_value (&ctx, "l2_misses");
195
 
204
 
196
 	za_submit_ratio ("arc", arc_hits, arc_misses);
197
 	za_submit_ratio ("L2", l2_hits, l2_misses);
198
 
199
 	/* I/O */
200
-	l2_io[0].derive = get_kstat_value(ksp, "l2_read_bytes");
201
-	l2_io[1].derive = get_kstat_value(ksp, "l2_write_bytes");
202
+	l2_io[0].derive = za_get_value (&ctx, "l2_read_bytes");
203
+	l2_io[1].derive = za_get_value (&ctx, "l2_write_bytes");
204
 
205
 	za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
206
 
207
@@ -163,14 +205,23 @@
208
 
209
 static int za_init (void) /* {{{ */
205
 static int za_init (void) /* {{{ */
210
 {
206
 {
211
-	ksp = NULL;
212
-
213
+#if defined(HAVE_LIBKSTAT)
207
+#if defined(HAVE_LIBKSTAT)
208
+	ksp = NULL;
209
+
214
 	/* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */
210
 	/* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */
215
 	if (kc == NULL)
211
 	if (kc == NULL)
216
 	{
212
 	{
217
 		ERROR ("zfs_arc plugin: kstat chain control structure not available.");
213
 		ERROR ("zfs_arc plugin: kstat chain control structure not available.");
218
 		return (-1);
214
 		return (-1);
219
 	}
215
 	}
220
+#elif defined(HAVE_SYSCTLBYNAME)
216
+#endif /* HAVE_LIBKSTAT */
221
+	/* make sure ARC is available (arc_size is not null) */
222
+	unsigned long long arc_size;
223
+	size_t size = sizeof(arc_size);
224
+	if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size, NULL, 0) != 0 || arc_size == 0)
225
+	{
226
+		ERROR ("zfs_arc plugin: could not get ARC size using sysctl, is ARC enabled?");
227
+		return (-1);
228
+	}
229
+#endif
230
 
217
 
231
 	return (0);
218
 	return (0);
232
 } /* }}} int za_init */
219
 } /* }}} int za_init */
220
@@ -179,7 +268,16 @@ static int za_init (void) /* {{{ */
221
 void module_register (void)
222
 {
223
 	plugin_register_init ("zfs_arc", za_init);
224
-	plugin_register_read ("zfs_arc", za_read);
225
+
226
+#if defined(HAVE_LIBKSTAT)
227
+	plugin_register_read ("zfs_arc", za_read_solaris);
228
+#elif defined(HAVE_SYSCTLBYNAME)
229
+	plugin_register_read ("zfs_arc", za_read_freebsd);
230
+#else
231
+	ERROR ("Unable to determine which OS we are on");
232
+	return (-1);
233
+#endif /* HAVE_SYSCTLBYNAME */
234
+
235
 } /* void module_register */
236
 
237
 /* vmi: set sw=8 noexpandtab fdm=marker : */
(-)files/patch-version-gen.sh (-10 / +8 lines)
Lines 1-10 Link Here
1
--- version-gen.sh.orig	2012-04-09 20:04:16.130293641 -0500
1
diff --git version-gen.sh version-gen.sh
2
+++ version-gen.sh	2012-04-09 20:05:04.927297496 -0500
2
index e344541..1ed7480 100755
3
@@ -1,17 +1,3 @@
3
--- version-gen.sh
4
+++ version-gen.sh
5
@@ -1,13 +1,3 @@
4
-#!/usr/bin/env bash
6
-#!/usr/bin/env bash
5
+#!/bin/sh
7
+#!/bin/sh
6
 
8
 
7
-DEFAULT_VERSION="5.1.0.git"
9
-DEFAULT_VERSION="5.2.1.git"
8
-
10
-
9
-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
11
-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
10
-
12
-
Lines 14-22 Link Here
14
-
16
-
15
-VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
17
-VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
16
-
18
-
17
-if test "x`uname -s`" = "xAIX" ; then
19
-echo -n "$VERSION"
18
-	echo "$VERSION\c"
20
+echo -n "5.2.1.git"
19
-else 
20
-	echo -n "$VERSION"
21
-fi
22
+echo -n "5.1.0.git"
(-)pkg-plist (-1 / +6 lines)
Lines 10-18 Link Here
10
%%CGI%%@exec if [ ! -f %B/collection.conf ] ; then cp -p %B/%f %B/collection.conf; fi
10
%%CGI%%@exec if [ ! -f %B/collection.conf ] ; then cp -p %B/%f %B/collection.conf; fi
11
%%CGI%%@dirrmtry %%WWWDIR%%
11
%%CGI%%@dirrmtry %%WWWDIR%%
12
bin/collectd-nagios
12
bin/collectd-nagios
13
bin/collectd-tg
13
bin/collectdctl
14
bin/collectdctl
14
include/collectd/client.h
15
include/collectd/client.h
15
include/collectd/lcc_features.h
16
include/collectd/lcc_features.h
17
include/collectd/network.h
18
include/collectd/network_buffer.h
19
lib/collectd/aggregation.la
20
lib/collectd/aggregation.so
16
%%APACHE%%lib/collectd/apache.la
21
%%APACHE%%lib/collectd/apache.la
17
%%APACHE%%lib/collectd/apache.so
22
%%APACHE%%lib/collectd/apache.so
18
%%APCUPS%%lib/collectd/apcups.la
23
%%APCUPS%%lib/collectd/apcups.la
Lines 123-129 Link Here
123
lib/collectd/zfs_arc.so
128
lib/collectd/zfs_arc.so
124
lib/libcollectdclient.la
129
lib/libcollectdclient.la
125
lib/libcollectdclient.so
130
lib/libcollectdclient.so
126
lib/libcollectdclient.so.0
131
lib/libcollectdclient.so.1
127
libdata/pkgconfig/libcollectdclient.pc
132
libdata/pkgconfig/libcollectdclient.pc
128
%%WRITE_HTTP%%lib/collectd/write_http.la
133
%%WRITE_HTTP%%lib/collectd/write_http.la
129
%%WRITE_HTTP%%lib/collectd/write_http.so
134
%%WRITE_HTTP%%lib/collectd/write_http.so

Return to bug 176691