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

Collapse All | Expand All

(-)net-mgmt/collectd5.new/Makefile (-5 / +4 lines)
Lines 2-9 Link Here
2
# $FreeBSD: head/net-mgmt/collectd5/Makefile 404774 2015-12-29 18:48:03Z junovitch $
2
# $FreeBSD: head/net-mgmt/collectd5/Makefile 404774 2015-12-29 18:48:03Z junovitch $
3
3
4
PORTNAME=	collectd
4
PORTNAME=	collectd
5
PORTVERSION=	5.5.0
5
PORTVERSION=	5.5.1
6
PORTREVISION=	4
7
CATEGORIES=	net-mgmt
6
CATEGORIES=	net-mgmt
8
MASTER_SITES=	https://collectd.org/files/ \
7
MASTER_SITES=	https://collectd.org/files/ \
9
		http://collectd.org/files/
8
		http://collectd.org/files/
Lines 79-86 Link Here
79
78
80
USE_LDCONFIG=	yes
79
USE_LDCONFIG=	yes
81
80
82
CONFLICTS=	collectd-4.[0-9]*
83
84
CPPFLAGS+=	-I${LOCALBASE}/include
81
CPPFLAGS+=	-I${LOCALBASE}/include
85
LIBS+=		-L${LOCALBASE}/lib
82
LIBS+=		-L${LOCALBASE}/lib
86
83
Lines 89-94 Link Here
89
		--disable-all-plugins \
86
		--disable-all-plugins \
90
		--disable-static \
87
		--disable-static \
91
		--without-amqp \
88
		--without-amqp \
89
		--disable-ceph \
90
		--disable-cgroups \
91
		--disable-fhcount \
92
		--without-java \
92
		--without-java \
93
		--without-libaquaero5 \
93
		--without-libaquaero5 \
94
		--without-libganglia \
94
		--without-libganglia \
Lines 277-283 Link Here
277
		--enable-dns \
277
		--enable-dns \
278
		--enable-email \
278
		--enable-email \
279
		--enable-exec \
279
		--enable-exec \
280
		--enable-fhcount \
281
		--enable-filecount \
280
		--enable-filecount \
282
		--enable-load \
281
		--enable-load \
283
		--enable-logfile \
282
		--enable-logfile \
(-)net-mgmt/collectd5.new/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (collectd-5.5.0.tar.bz2) = 847684cf5c10de1dc34145078af3fcf6e0d168ba98c14f1343b1062a4b569e88
1
SHA256 (collectd-5.5.1.tar.bz2) = f9c5d526e1f0429a7db1ccd90bdf9e23923a2fd43b7285cfda8f0341e5c0bc3f
2
SIZE (collectd-5.5.0.tar.bz2) = 1824495
2
SIZE (collectd-5.5.1.tar.bz2) = 1797852
(-)net-mgmt/collectd5.new/files/patch-Makefile.am (-2 / +2 lines)
Lines 1-6 Link Here
1
--- Makefile.am.orig	2015-03-09 09:38:22 UTC
1
--- Makefile.am.orig	2016-01-22 08:33:25 UTC
2
+++ Makefile.am
2
+++ Makefile.am
3
@@ -8,7 +8,6 @@ EXTRA_DIST = contrib version-gen.sh
3
@@ -14,7 +14,6 @@ EXTRA_DIST = contrib version-gen.sh
4
 
4
 
5
 install-exec-hook:
5
 install-exec-hook:
6
 	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run
6
 	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run
(-)net-mgmt/collectd5.new/files/patch-configure.ac (-14 / +14 lines)
Lines 1-6 Link Here
1
--- configure.ac.orig	2015-05-27 07:51:35 UTC
1
--- configure.ac.orig	2016-01-22 09:51:17 UTC
2
+++ configure.ac
2
+++ configure.ac
3
@@ -120,7 +120,7 @@ then
3
@@ -155,7 +155,7 @@ then
4
 fi
4
 fi
5
 
5
 
6
 # Where to install .pc files.
6
 # Where to install .pc files.
Lines 9-15 Link Here
9
 AC_SUBST(pkgconfigdir)
9
 AC_SUBST(pkgconfigdir)
10
 
10
 
11
 # Check for standards compliance mode
11
 # Check for standards compliance mode
12
@@ -641,7 +641,7 @@ SAVE_CFLAGS="$CFLAGS"
12
@@ -715,7 +715,7 @@ SAVE_CFLAGS="$CFLAGS"
13
 # Emulate behavior of src/Makefile.am
13
 # Emulate behavior of src/Makefile.am
14
 if test "x$GCC" = "xyes"
14
 if test "x$GCC" = "xyes"
15
 then
15
 then
Lines 18-24 Link Here
18
 fi
18
 fi
19
 
19
 
20
 AC_CACHE_CHECK([for strtok_r],
20
 AC_CACHE_CHECK([for strtok_r],
21
@@ -770,7 +770,7 @@ AC_CHECK_FUNCS(getutxent, [have_getutxen
21
@@ -844,7 +844,7 @@ AC_CHECK_FUNCS(getutxent, [have_getutxen
22
 if test "x$GCC" = "xyes"
22
 if test "x$GCC" = "xyes"
23
 then
23
 then
24
 	SAVE_CFLAGS="$CFLAGS"
24
 	SAVE_CFLAGS="$CFLAGS"
Lines 27-33 Link Here
27
 fi
27
 fi
28
 
28
 
29
 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
29
 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
30
@@ -1495,6 +1495,7 @@ if test "x$with_kstat" = "xyes"
30
@@ -1571,6 +1571,7 @@ if test "x$with_kstat" = "xyes"
31
 then
31
 then
32
 	AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
32
 	AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
33
 fi
33
 fi
Lines 35-41 Link Here
35
 if test "x$with_kstat" = "xyes"
35
 if test "x$with_kstat" = "xyes"
36
 then
36
 then
37
 	AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
37
 	AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
38
@@ -1504,6 +1505,8 @@ if test "x$with_kstat" = "xyes"
38
@@ -1580,6 +1581,8 @@ if test "x$with_kstat" = "xyes"
39
 then
39
 then
40
 	AC_DEFINE(HAVE_LIBKSTAT, 1,
40
 	AC_DEFINE(HAVE_LIBKSTAT, 1,
41
 		  [Define to 1 if you have the 'kstat' library (-lkstat)])
41
 		  [Define to 1 if you have the 'kstat' library (-lkstat)])
Lines 44-50 Link Here
44
 fi
44
 fi
45
 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
45
 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
46
 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
46
 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
47
@@ -3346,7 +3349,7 @@ then
47
@@ -3415,7 +3418,7 @@ then
48
 	SAVE_LIBS="$LIBS"
48
 	SAVE_LIBS="$LIBS"
49
 	# trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
49
 	# trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
50
 	# (see issues #41 and #42)
50
 	# (see issues #41 and #42)
Lines 53-59 Link Here
53
 	LIBS="$LIBS $PERL_LIBS"
53
 	LIBS="$LIBS $PERL_LIBS"
54
 
54
 
55
 	AC_CACHE_CHECK([for broken Perl_load_module()],
55
 	AC_CACHE_CHECK([for broken Perl_load_module()],
56
@@ -3576,7 +3579,7 @@ fi
56
@@ -3645,7 +3648,7 @@ fi
57
 if test "x$with_python" = "xyes"
57
 if test "x$with_python" = "xyes"
58
 then
58
 then
59
 	AC_MSG_CHECKING([for Python CPPFLAGS])
59
 	AC_MSG_CHECKING([for Python CPPFLAGS])
Lines 62-68 Link Here
62
 	python_config_status=$?
62
 	python_config_status=$?
63
 
63
 
64
 	if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
64
 	if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
65
@@ -3599,7 +3602,7 @@ fi
65
@@ -3668,7 +3671,7 @@ fi
66
 if test "x$with_python" = "xyes"
66
 if test "x$with_python" = "xyes"
67
 then
67
 then
68
 	AC_MSG_CHECKING([for Python LDFLAGS])
68
 	AC_MSG_CHECKING([for Python LDFLAGS])
Lines 71-77 Link Here
71
 	python_config_status=$?
71
 	python_config_status=$?
72
 
72
 
73
 	if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
73
 	if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
74
@@ -3614,7 +3617,7 @@ fi
74
@@ -3683,7 +3686,7 @@ fi
75
 if test "x$with_python" = "xyes"
75
 if test "x$with_python" = "xyes"
76
 then
76
 then
77
 	AC_MSG_CHECKING([for Python LIBS])
77
 	AC_MSG_CHECKING([for Python LIBS])
Lines 80-86 Link Here
80
 	python_config_status=$?
80
 	python_config_status=$?
81
 
81
 
82
 	if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
82
 	if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
83
@@ -3629,7 +3632,7 @@ fi
83
@@ -3698,7 +3701,7 @@ fi
84
 if test "x$with_python" = "xyes"
84
 if test "x$with_python" = "xyes"
85
 then
85
 then
86
 	LDFLAGS="-L$python_library_path $LDFLAGS"
86
 	LDFLAGS="-L$python_library_path $LDFLAGS"
Lines 89-95 Link Here
89
 
89
 
90
 	AC_CHECK_FUNC(PyObject_CallFunction,
90
 	AC_CHECK_FUNC(PyObject_CallFunction,
91
 		      [with_python="yes"],
91
 		      [with_python="yes"],
92
@@ -4692,8 +4695,8 @@ AC_ARG_WITH(libvarnish, [AS_HELP_STRING(
92
@@ -4761,8 +4764,8 @@ AC_ARG_WITH(libvarnish, [AS_HELP_STRING(
93
 	else if test -d "$with_libvarnish/lib"
93
 	else if test -d "$with_libvarnish/lib"
94
 	then
94
 	then
95
 		AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
95
 		AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
Lines 100-110 Link Here
100
 		with_libvarnish="yes"
100
 		with_libvarnish="yes"
101
 	fi; fi; fi
101
 	fi; fi; fi
102
 ],
102
 ],
103
@@ -5263,6 +5266,7 @@ fi
103
@@ -5334,6 +5337,7 @@ fi
104
 
104
 
105
 if test "x$ac_system" = "xFreeBSD"
105
 if test "x$ac_system" = "xFreeBSD"
106
 then
106
 then
107
+	plugin_disk="yes"
107
+	plugin_disk="yes"
108
         plugin_zfs_arc="yes"
108
 	plugin_zfs_arc="yes"
109
 fi
109
 fi
110
 
110
 
(-)net-mgmt/collectd5.new/files/patch-src__Makefile.am (-10 / +10 lines)
Lines 1-4 Link Here
1
--- src/Makefile.am.orig	2015-05-26 19:38:14 UTC
1
--- src/Makefile.am.orig	2016-01-22 09:51:17 UTC
2
+++ src/Makefile.am
2
+++ src/Makefile.am
3
@@ -7,14 +7,14 @@ SUBDIRS += daemon
3
@@ -7,14 +7,14 @@ SUBDIRS += daemon
4
 PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '\<module_register\>'
4
 PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '\<module_register\>'
Lines 26-32 Link Here
26
 endif
26
 endif
27
 if BUILD_WITH_LIBDEVINFO
27
 if BUILD_WITH_LIBDEVINFO
28
 cpu_la_LIBADD += -ldevinfo
28
 cpu_la_LIBADD += -ldevinfo
29
@@ -303,7 +303,7 @@ disk_la_CFLAGS = $(AM_CFLAGS)
29
@@ -301,7 +301,7 @@ disk_la_CFLAGS = $(AM_CFLAGS)
30
 disk_la_LDFLAGS = $(PLUGIN_LDFLAGS)
30
 disk_la_LDFLAGS = $(PLUGIN_LDFLAGS)
31
 disk_la_LIBADD =
31
 disk_la_LIBADD =
32
 if BUILD_WITH_LIBKSTAT
32
 if BUILD_WITH_LIBKSTAT
Lines 35-41 Link Here
35
 endif
35
 endif
36
 if BUILD_WITH_LIBDEVINFO
36
 if BUILD_WITH_LIBDEVINFO
37
 disk_la_LIBADD += -ldevinfo
37
 disk_la_LIBADD += -ldevinfo
38
@@ -321,6 +321,9 @@ endif
38
@@ -319,6 +319,9 @@ endif
39
 if BUILD_WITH_PERFSTAT
39
 if BUILD_WITH_PERFSTAT
40
 disk_la_LIBADD += -lperfstat
40
 disk_la_LIBADD += -lperfstat
41
 endif
41
 endif
Lines 45-51 Link Here
45
 endif
45
 endif
46
 
46
 
47
 if BUILD_PLUGIN_DNS
47
 if BUILD_PLUGIN_DNS
48
@@ -408,7 +411,7 @@ interface_la_CFLAGS += $(BUILD_WITH_LIBS
48
@@ -405,7 +408,7 @@ interface_la_CFLAGS += $(BUILD_WITH_LIBS
49
 interface_la_LIBADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
49
 interface_la_LIBADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
50
 else
50
 else
51
 if BUILD_WITH_LIBKSTAT
51
 if BUILD_WITH_LIBKSTAT
Lines 54-60 Link Here
54
 endif
54
 endif
55
 if BUILD_WITH_LIBDEVINFO
55
 if BUILD_WITH_LIBDEVINFO
56
 interface_la_LIBADD += -ldevinfo
56
 interface_la_LIBADD += -ldevinfo
57
@@ -591,7 +594,7 @@ memory_la_CFLAGS = $(AM_CFLAGS)
57
@@ -584,7 +587,7 @@ memory_la_CFLAGS = $(AM_CFLAGS)
58
 memory_la_LDFLAGS = $(PLUGIN_LDFLAGS)
58
 memory_la_LDFLAGS = $(PLUGIN_LDFLAGS)
59
 memory_la_LIBADD =
59
 memory_la_LIBADD =
60
 if BUILD_WITH_LIBKSTAT
60
 if BUILD_WITH_LIBKSTAT
Lines 63-69 Link Here
63
 endif
63
 endif
64
 if BUILD_WITH_LIBDEVINFO
64
 if BUILD_WITH_LIBDEVINFO
65
 memory_la_LIBADD += -ldevinfo
65
 memory_la_LIBADD += -ldevinfo
66
@@ -964,7 +967,7 @@ swap_la_CFLAGS = $(AM_CFLAGS)
66
@@ -951,7 +954,7 @@ swap_la_CFLAGS = $(AM_CFLAGS)
67
 swap_la_LDFLAGS = $(PLUGIN_LDFLAGS)
67
 swap_la_LDFLAGS = $(PLUGIN_LDFLAGS)
68
 swap_la_LIBADD =
68
 swap_la_LIBADD =
69
 if BUILD_WITH_LIBKSTAT
69
 if BUILD_WITH_LIBKSTAT
Lines 72-78 Link Here
72
 endif
72
 endif
73
 if BUILD_WITH_LIBDEVINFO
73
 if BUILD_WITH_LIBDEVINFO
74
 swap_la_LIBADD += -ldevinfo
74
 swap_la_LIBADD += -ldevinfo
75
@@ -1010,7 +1013,7 @@ if BUILD_PLUGIN_TAPE
75
@@ -997,7 +1000,7 @@ if BUILD_PLUGIN_TAPE
76
 pkglib_LTLIBRARIES += tape.la
76
 pkglib_LTLIBRARIES += tape.la
77
 tape_la_SOURCES = tape.c
77
 tape_la_SOURCES = tape.c
78
 tape_la_LDFLAGS = $(PLUGIN_LDFLAGS)
78
 tape_la_LDFLAGS = $(PLUGIN_LDFLAGS)
Lines 81-87 Link Here
81
 endif
81
 endif
82
 
82
 
83
 if BUILD_PLUGIN_TARGET_NOTIFICATION
83
 if BUILD_PLUGIN_TARGET_NOTIFICATION
84
@@ -1116,7 +1119,7 @@ uptime_la_CFLAGS = $(AM_CFLAGS)
84
@@ -1102,7 +1105,7 @@ uptime_la_CFLAGS = $(AM_CFLAGS)
85
 uptime_la_LDFLAGS = $(PLUGIN_LDFLAGS)
85
 uptime_la_LDFLAGS = $(PLUGIN_LDFLAGS)
86
 uptime_la_LIBADD =
86
 uptime_la_LIBADD =
87
 if BUILD_WITH_LIBKSTAT
87
 if BUILD_WITH_LIBKSTAT
Lines 90-96 Link Here
90
 endif
90
 endif
91
 if BUILD_WITH_PERFSTAT
91
 if BUILD_WITH_PERFSTAT
92
 uptime_la_LIBADD += -lperfstat
92
 uptime_la_LIBADD += -lperfstat
93
@@ -1275,7 +1278,7 @@ if BUILD_LINUX
93
@@ -1260,7 +1263,7 @@ if BUILD_LINUX
94
 # zfs_arc requires no library on linux
94
 # zfs_arc requires no library on linux
95
 else
95
 else
96
 # solaris
96
 # solaris
Lines 99-105 Link Here
99
 endif
99
 endif
100
 endif
100
 endif
101
 endif
101
 endif
102
@@ -1364,12 +1367,7 @@ endif
102
@@ -1354,12 +1357,7 @@ endif
103
 
103
 
104
 install-exec-hook:
104
 install-exec-hook:
105
 	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
105
 	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
(-)net-mgmt/collectd5.new/files/patch-src__Makefile.in (-2 / +2 lines)
Lines 1-6 Link Here
1
--- src/Makefile.in.orig	2015-05-27 07:51:49.001922000 +0000
1
--- src/Makefile.in.orig	2016-01-22 09:55:46 UTC
2
+++ src/Makefile.in
2
+++ src/Makefile.in
3
@@ -2434,7 +2434,7 @@ PLUGIN_LDFLAGS = -module -avoid-version 
3
@@ -2426,7 +2426,7 @@ PLUGIN_LDFLAGS = -module -avoid-version 
4
 AM_CPPFLAGS = -I$(srcdir)/daemon -DPREFIX='"${prefix}"' \
4
 AM_CPPFLAGS = -I$(srcdir)/daemon -DPREFIX='"${prefix}"' \
5
 	-DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
5
 	-DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
6
 	-DLOCALSTATEDIR='"${localstatedir}"' \
6
 	-DLOCALSTATEDIR='"${localstatedir}"' \
(-)net-mgmt/collectd5.new/files/patch-src__daemon__Makefile.am (-11 / +2 lines)
Lines 1-6 Link Here
1
--- src/daemon/Makefile.am.orig	2015-05-26 19:38:31 UTC
1
--- src/daemon/Makefile.am.orig	2016-01-22 09:51:17 UTC
2
+++ src/daemon/Makefile.am
2
+++ src/daemon/Makefile.am
3
@@ -6,7 +6,7 @@
3
@@ -6,7 +6,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src
4
 AM_CPPFLAGS += -DPREFIX='"${prefix}"'
4
 AM_CPPFLAGS += -DPREFIX='"${prefix}"'
5
 AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
5
 AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
6
 AM_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"'
6
 AM_CPPFLAGS += -DLOCALSTATEDIR='"${localstatedir}"'
Lines 9-20 Link Here
9
 if BUILD_FEATURE_DAEMON
9
 if BUILD_FEATURE_DAEMON
10
 AM_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
10
 AM_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
11
 endif
11
 endif
12
@@ -49,7 +49,7 @@ collectd_CPPFLAGS =  $(AM_CPPFLAGS) $(LT
13
 collectd_CFLAGS = $(AM_CFLAGS)
14
 collectd_LDFLAGS = -export-dynamic
15
 collectd_LDADD = libavltree.la libcommon.la libheap.la -lm
16
-collectd_DEPENDENCIES =
17
+collectd_DEPENDENCIES = libavltree.la libcommon.la libheap.la
18
 
19
 # Link to these libraries..
20
 if BUILD_WITH_LIBRT
(-)net-mgmt/collectd5.new/files/patch-src__daemon__collectd.h (-1 / +1 lines)
Lines 1-4 Link Here
1
--- src/daemon/collectd.h.orig	2015-05-22 10:04:36 UTC
1
--- src/daemon/collectd.h.orig	2016-01-22 09:51:17 UTC
2
+++ src/daemon/collectd.h
2
+++ src/daemon/collectd.h
3
@@ -240,15 +240,15 @@ typedef int _Bool;
3
@@ -240,15 +240,15 @@ typedef int _Bool;
4
 #endif
4
 #endif
(-)net-mgmt/collectd5.new/files/patch-src__dns.c (-2 / +2 lines)
Lines 1-6 Link Here
1
--- src/dns.c.orig	2015-03-10 14:14:45 UTC
1
--- src/dns.c.orig	2016-01-22 09:51:17 UTC
2
+++ src/dns.c
2
+++ src/dns.c
3
@@ -224,6 +224,15 @@ static int dns_run_pcap_loop (void)
3
@@ -223,6 +223,15 @@ static int dns_run_pcap_loop (void)
4
 		pthread_sigmask (SIG_SETMASK, &sigmask, NULL);
4
 		pthread_sigmask (SIG_SETMASK, &sigmask, NULL);
5
 	}
5
 	}
6
 
6
 
(-)net-mgmt/collectd5.new/files/patch-src__modbus.c (-2 / +2 lines)
Lines 1-4 Link Here
1
--- src/modbus.c.orig	2015-05-20 12:04:47 UTC
1
--- src/modbus.c.orig	2016-01-22 09:51:17 UTC
2
+++ src/modbus.c
2
+++ src/modbus.c
3
@@ -25,6 +25,9 @@
3
@@ -25,6 +25,9 @@
4
 #include "plugin.h"
4
 #include "plugin.h"
Lines 9-12 Link Here
9
+
9
+
10
 #include <netdb.h>
10
 #include <netdb.h>
11
 
11
 
12
 #include <modbus/modbus.h>
12
 #include <modbus.h>
(-)net-mgmt/collectd5.new/files/patch-src__varnish.c (-806 lines)
Lines 1-806 Link Here
1
commit 0eebd2655842fbb634f67afd44fa4fdcf4e6f189
2
Author: Ruben Kerkhof <ruben@rubenkerkhof.com>
3
Date:   Sat Jul 4 22:49:49 2015 +0200
4
5
    varnish: fix leak on read
6
    
7
    Since VSM_Close doesn't free the object we leak a few bytes
8
    every interval
9
10
commit b208ddc7d08978f4cf52364c1935e94a0479ee42
11
Author: Marc Fournier <marc.fournier@camptocamp.com>
12
Date:   Wed Nov 4 21:12:36 2015 +0100
13
14
    varnish: isolate varnish v2 code
15
    
16
    Segregating v2-specific code will allow reworking the v3 and v4 parts,
17
    while ensuring backwards compatibility with v2.
18
    
19
    The downside is that this leads to a large chunk of mostly duplicate
20
    code. That said, my suggestion would be to drop support for varnish v2
21
    in collectd 5.6.
22
    
23
    NB: this commit breaks v3 and v4 support.
24
25
commit d010d9eff882765201359959a583033dae4b373c
26
Author: Marc Fournier <marc.fournier@camptocamp.com>
27
Date:   Wed Nov 4 22:57:00 2015 +0100
28
29
    varnish: rework v3 and v4 support
30
    
31
    By using VSC_Iter() to loop over the list of metrics exposed by varnish,
32
    we can pick those we're interested *if they are found*.
33
    
34
    Not explicitly referring to metrics in the VSC_C_main struct makes the
35
    plugin more resilient to small differences between minor varnish
36
    versions.
37
    
38
    It also opens the possibility to monitor non-MAIN metrics, such as
39
    per-backend or per-storage engine stats.
40
    
41
    This patch should be compatible with the previous way of doing, from the
42
    user point of view.
43
    
44
    Fix #1302
45
46
commit 08bd4dd86e0fcb6828819cdf6bb3ae2115b1b8f4
47
Author: Marc Fournier <marc.fournier@camptocamp.com>
48
Date:   Thu Nov 5 10:23:19 2015 +0100
49
50
    varnish: remove unused variable
51
    
52
    This was used in a DEBUG statement I didn't check in.
53
54
--- src/varnish.c.orig	2015-03-10 14:14:45 UTC
55
+++ src/varnish.c
56
@@ -135,6 +135,397 @@ static int varnish_submit_derive (const 
57
 	return (varnish_submit (plugin_instance, category, type, type_instance, value));
58
 } /* }}} int varnish_submit_derive */
59
 
60
+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
61
+static int varnish_monitor (void *priv, const struct VSC_point * const pt) /* {{{ */
62
+{
63
+	uint64_t val;
64
+	const user_config_t *conf;
65
+	const char *class;
66
+	const char *name;
67
+
68
+	if (pt == NULL)
69
+		return (0);
70
+
71
+	conf = priv;
72
+
73
+#if HAVE_VARNISH_V4
74
+	class = pt->section->fantom->type;
75
+	name  = pt->desc->name;
76
+
77
+	if (strcmp(class, "MAIN") != 0)
78
+		return (0);
79
+
80
+#elif HAVE_VARNISH_V3
81
+	class = pt->class;
82
+	name  = pt->name;
83
+
84
+	if (strcmp(class, "") != 0)
85
+		return (0);
86
+#endif
87
+
88
+	val = *(const volatile uint64_t*) pt->ptr;
89
+
90
+	if (conf->collect_cache)
91
+	{
92
+		if (strcmp(name, "cache_hit") == 0)
93
+			return varnish_submit_derive (conf->instance, "cache", "cache_result", "hit",     val);
94
+		else if (strcmp(name, "cache_miss") == 0)
95
+			return varnish_submit_derive (conf->instance, "cache", "cache_result", "miss",    val);
96
+		else if (strcmp(name, "cache_hitpass") == 0)
97
+			return varnish_submit_derive (conf->instance, "cache", "cache_result", "hitpass", val);
98
+	}
99
+
100
+	if (conf->collect_connections)
101
+	{
102
+		if (strcmp(name, "client_conn") == 0)
103
+			return varnish_submit_derive (conf->instance, "connections", "connections", "accepted", val);
104
+		else if (strcmp(name, "client_drop") == 0)
105
+			return varnish_submit_derive (conf->instance, "connections", "connections", "dropped" , val);
106
+		else if (strcmp(name, "client_req") == 0)
107
+			return varnish_submit_derive (conf->instance, "connections", "connections", "received", val);
108
+	}
109
+
110
+#ifdef HAVE_VARNISH_V3
111
+	if (conf->collect_dirdns)
112
+	{
113
+		if (strcmp(name, "dir_dns_lookups") == 0)
114
+			return varnish_submit_derive (conf->instance, "dirdns", "cache_operation", "lookups",    val);
115
+		else if (strcmp(name, "dir_dns_failed") == 0)
116
+			return varnish_submit_derive (conf->instance, "dirdns", "cache_result",    "failed",     val);
117
+		else if (strcmp(name, "dir_dns_hit") == 0)
118
+			return varnish_submit_derive (conf->instance, "dirdns", "cache_result",    "hits",       val);
119
+		else if (strcmp(name, "dir_dns_cache_full") == 0)
120
+			return varnish_submit_derive (conf->instance, "dirdns", "cache_result",    "cache_full", val);
121
+	}
122
+#endif
123
+
124
+	if (conf->collect_esi)
125
+	{
126
+		if (strcmp(name, "esi_errors") == 0)
127
+			return varnish_submit_derive (conf->instance, "esi", "total_operations", "error",   val);
128
+		else if (strcmp(name, "esi_parse") == 0)
129
+			return varnish_submit_derive (conf->instance, "esi", "total_operations", "parsed",  val);
130
+		else if (strcmp(name, "esi_warnings") == 0)
131
+			return varnish_submit_derive (conf->instance, "esi", "total_operations", "warning", val);
132
+	}
133
+
134
+	if (conf->collect_backend)
135
+	{
136
+		if (strcmp(name, "backend_conn") == 0)
137
+			return varnish_submit_derive (conf->instance, "backend", "connections", "success",       val);
138
+		else if (strcmp(name, "backend_unhealthy") == 0)
139
+			return varnish_submit_derive (conf->instance, "backend", "connections", "not-attempted", val);
140
+		else if (strcmp(name, "backend_busy") == 0)
141
+			return varnish_submit_derive (conf->instance, "backend", "connections", "too-many",      val);
142
+		else if (strcmp(name, "backend_fail") == 0)
143
+			return varnish_submit_derive (conf->instance, "backend", "connections", "failures",      val);
144
+		else if (strcmp(name, "backend_reuse") == 0)
145
+			return varnish_submit_derive (conf->instance, "backend", "connections", "reuses",        val);
146
+		else if (strcmp(name, "backend_toolate") == 0)
147
+			return varnish_submit_derive (conf->instance, "backend", "connections", "was-closed",    val);
148
+		else if (strcmp(name, "backend_recycle") == 0)
149
+			return varnish_submit_derive (conf->instance, "backend", "connections", "recycled",      val);
150
+		else if (strcmp(name, "backend_unused") == 0)
151
+			return varnish_submit_derive (conf->instance, "backend", "connections", "unused",        val);
152
+		else if (strcmp(name, "backend_retry") == 0)
153
+			return varnish_submit_derive (conf->instance, "backend", "connections", "retries",       val);
154
+		else if (strcmp(name, "backend_req") == 0)
155
+			return varnish_submit_derive (conf->instance, "backend", "http_requests", "requests",    val);
156
+		else if (strcmp(name, "n_backend") == 0)
157
+			return varnish_submit_gauge  (conf->instance, "backend", "backends", "n_backends",       val);
158
+	}
159
+
160
+	if (conf->collect_fetch)
161
+	{
162
+		if (strcmp(name, "fetch_head") == 0)
163
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "head",        val);
164
+		else if (strcmp(name, "fetch_length") == 0)
165
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "length",      val);
166
+		else if (strcmp(name, "fetch_chunked") == 0)
167
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "chunked",     val);
168
+		else if (strcmp(name, "fetch_eof") == 0)
169
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "eof",         val);
170
+		else if (strcmp(name, "fetch_bad") == 0)
171
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "bad_headers", val);
172
+		else if (strcmp(name, "fetch_close") == 0)
173
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "close",       val);
174
+		else if (strcmp(name, "fetch_oldhttp") == 0)
175
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "oldhttp",     val);
176
+		else if (strcmp(name, "fetch_zero") == 0)
177
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "zero",        val);
178
+		else if (strcmp(name, "fetch_failed") == 0)
179
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "failed",      val);
180
+		else if (strcmp(name, "fetch_1xx") == 0)
181
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_1xx", val);
182
+		else if (strcmp(name, "fetch_204") == 0)
183
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_204", val);
184
+		else if (strcmp(name, "fetch_304") == 0)
185
+			return varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_304", val);
186
+	}
187
+
188
+	if (conf->collect_hcb)
189
+	{
190
+		if (strcmp(name, "hcb_nolock") == 0)
191
+			return varnish_submit_derive (conf->instance, "hcb", "cache_operation", "lookup_nolock", val);
192
+		else if (strcmp(name, "hcb_lock") == 0)
193
+			return varnish_submit_derive (conf->instance, "hcb", "cache_operation", "lookup_lock",   val);
194
+		else if (strcmp(name, "hcb_insert") == 0)
195
+			return varnish_submit_derive (conf->instance, "hcb", "cache_operation", "insert",        val);
196
+	}
197
+
198
+	if (conf->collect_objects)
199
+	{
200
+		if (strcmp(name, "n_expired") == 0)
201
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "expired",            val);
202
+		else if (strcmp(name, "n_lru_nuked") == 0)
203
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_nuked",          val);
204
+		else if (strcmp(name, "n_lru_saved") == 0)
205
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_saved",          val);
206
+		else if (strcmp(name, "n_lru_moved") == 0)
207
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_moved",          val);
208
+		else if (strcmp(name, "n_deathrow") == 0)
209
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "deathrow",           val);
210
+		else if (strcmp(name, "losthdr") == 0)
211
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "header_overflow",    val);
212
+		else if (strcmp(name, "n_obj_purged") == 0)
213
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "purged",             val);
214
+		else if (strcmp(name, "n_objsendfile") == 0)
215
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_sendfile",      val);
216
+		else if (strcmp(name, "n_objwrite") == 0)
217
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_write",         val);
218
+		else if (strcmp(name, "n_objoverflow") == 0)
219
+			return varnish_submit_derive (conf->instance, "objects", "total_objects", "workspace_overflow", val);
220
+	}
221
+
222
+#if HAVE_VARNISH_V3
223
+	if (conf->collect_ban)
224
+	{
225
+		if (strcmp(name, "n_ban") == 0)
226
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "total",          val);
227
+		else if (strcmp(name, "n_ban_add") == 0)
228
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "added",          val);
229
+		else if (strcmp(name, "n_ban_retire") == 0)
230
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted",        val);
231
+		else if (strcmp(name, "n_ban_obj_test") == 0)
232
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "objects_tested", val);
233
+		else if (strcmp(name, "n_ban_re_test") == 0)
234
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "regexps_tested", val);
235
+		else if (strcmp(name, "n_ban_dups") == 0)
236
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate",      val);
237
+	}
238
+#endif
239
+#if HAVE_VARNISH_V4
240
+	if (conf->collect_ban)
241
+	{
242
+		if (strcmp(name, "bans") == 0)
243
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "total",     val);
244
+		else if (strcmp(name, "bans_added") == 0)
245
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "added",     val);
246
+		else if (strcmp(name, "bans_obj") == 0)
247
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "obj",       val);
248
+		else if (strcmp(name, "bans_req") == 0)
249
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "req",       val);
250
+		else if (strcmp(name, "bans_completed") == 0)
251
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "completed", val);
252
+		else if (strcmp(name, "bans_deleted") == 0)
253
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted",   val);
254
+		else if (strcmp(name, "bans_tested") == 0)
255
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "tested",    val);
256
+		else if (strcmp(name, "bans_dups") == 0)
257
+			return varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate", val);
258
+	}
259
+#endif
260
+
261
+	if (conf->collect_session)
262
+	{
263
+		if (strcmp(name, "sess_closed") == 0)
264
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "closed",    val);
265
+		else if (strcmp(name, "sess_pipeline") == 0)
266
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "pipeline",  val);
267
+		else if (strcmp(name, "sess_readahead") == 0)
268
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "readahead", val);
269
+		else if (strcmp(name, "sess_conn") == 0)
270
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "accepted",  val);
271
+		else if (strcmp(name, "sess_drop") == 0)
272
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "dropped",   val);
273
+		else if (strcmp(name, "sess_fail") == 0)
274
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "failed",    val);
275
+		else if (strcmp(name, "sess_pipe_overflow") == 0)
276
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "overflow",  val);
277
+		else if (strcmp(name, "sess_queued") == 0)
278
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "queued",    val);
279
+		else if (strcmp(name, "sess_linger") == 0)
280
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "linger",    val);
281
+		else if (strcmp(name, "sess_herd") == 0)
282
+			return varnish_submit_derive (conf->instance, "session", "total_operations", "herd",      val);
283
+	}
284
+
285
+	if (conf->collect_shm)
286
+	{
287
+		if (strcmp(name, "shm_records") == 0)
288
+			return varnish_submit_derive (conf->instance, "shm", "total_operations", "records",    val);
289
+		else if (strcmp(name, "shm_writes") == 0)
290
+			return varnish_submit_derive (conf->instance, "shm", "total_operations", "writes",     val);
291
+		else if (strcmp(name, "shm_flushes") == 0)
292
+			return varnish_submit_derive (conf->instance, "shm", "total_operations", "flushes",    val);
293
+		else if (strcmp(name, "shm_cont") == 0)
294
+			return varnish_submit_derive (conf->instance, "shm", "total_operations", "contention", val);
295
+		else if (strcmp(name, "shm_cycles") == 0)
296
+			return varnish_submit_derive (conf->instance, "shm", "total_operations", "cycles",     val);
297
+	}
298
+
299
+	if (conf->collect_sms)
300
+	{
301
+		if (strcmp(name, "sms_nreq") == 0)
302
+			return varnish_submit_derive (conf->instance, "sms", "total_requests", "allocator", val);
303
+		else if (strcmp(name, "sms_nobj") == 0)
304
+			return varnish_submit_gauge (conf->instance,  "sms", "requests", "outstanding",     val);
305
+		else if (strcmp(name, "sms_nbytes") == 0)
306
+			return varnish_submit_gauge (conf->instance,  "sms", "bytes", "outstanding",        val);
307
+		else if (strcmp(name, "sms_balloc") == 0)
308
+			return varnish_submit_derive (conf->instance,  "sms", "total_bytes", "allocated",   val);
309
+		else if (strcmp(name, "sms_bfree") == 0)
310
+			return varnish_submit_derive (conf->instance,  "sms", "total_bytes", "free",        val);
311
+	}
312
+
313
+	if (conf->collect_struct)
314
+	{
315
+		if (strcmp(name, "n_sess_mem") == 0)
316
+			return varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess_mem",  val);
317
+		else if (strcmp(name, "n_sess") == 0)
318
+			return varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess",      val);
319
+		else if (strcmp(name, "n_object") == 0)
320
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "object",             val);
321
+		else if (strcmp(name, "n_vampireobject") == 0)
322
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "vampireobject",      val);
323
+		else if (strcmp(name, "n_objectcore") == 0)
324
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "objectcore",         val);
325
+		else if (strcmp(name, "n_waitinglist") == 0)
326
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "waitinglist",        val);
327
+		else if (strcmp(name, "n_objecthead") == 0)
328
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "objecthead",         val);
329
+		else if (strcmp(name, "n_smf") == 0)
330
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "smf",                val);
331
+		else if (strcmp(name, "n_smf_frag") == 0)
332
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "smf_frag",           val);
333
+		else if (strcmp(name, "n_smf_large") == 0)
334
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "smf_large",          val);
335
+		else if (strcmp(name, "n_vbe_conn") == 0)
336
+			return varnish_submit_gauge (conf->instance, "struct", "objects", "vbe_conn",           val);
337
+	}
338
+
339
+	if (conf->collect_totals)
340
+	{
341
+		if (strcmp(name, "s_sess") == 0)
342
+			return varnish_submit_derive (conf->instance, "totals", "total_sessions", "sessions",  val);
343
+		else if (strcmp(name, "s_req") == 0)
344
+			return varnish_submit_derive (conf->instance, "totals", "total_requests", "requests",  val);
345
+		else if (strcmp(name, "s_pipe") == 0)
346
+			return varnish_submit_derive (conf->instance, "totals", "total_operations", "pipe",    val);
347
+		else if (strcmp(name, "s_pass") == 0)
348
+			return varnish_submit_derive (conf->instance, "totals", "total_operations", "pass",    val);
349
+		else if (strcmp(name, "s_fetch") == 0)
350
+			return varnish_submit_derive (conf->instance, "totals", "total_operations", "fetches", val);
351
+		else if (strcmp(name, "s_synth") == 0)
352
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "synth",        val);
353
+		else if (strcmp(name, "s_req_hdrbytes") == 0)
354
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_header",   val);
355
+		else if (strcmp(name, "s_req_bodybytes") == 0)
356
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_body",     val);
357
+		else if (strcmp(name, "s_resp_hdrbytes") == 0)
358
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_header",  val);
359
+		else if (strcmp(name, "s_resp_bodybytes") == 0)
360
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_body",    val);
361
+		else if (strcmp(name, "s_pipe_hdrbytes") == 0)
362
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_header",  val);
363
+		else if (strcmp(name, "s_pipe_in") == 0)
364
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_in",      val);
365
+		else if (strcmp(name, "s_pipe_out") == 0)
366
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_out",     val);
367
+		else if (strcmp(name, "n_purges") == 0)
368
+			return varnish_submit_derive (conf->instance, "totals", "total_operations", "purges",  val);
369
+		else if (strcmp(name, "s_hdrbytes") == 0)
370
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "header-bytes", val);
371
+		else if (strcmp(name, "s_bodybytes") == 0)
372
+			return varnish_submit_derive (conf->instance, "totals", "total_bytes", "body-bytes",   val);
373
+		else if (strcmp(name, "n_gzip") == 0)
374
+			return varnish_submit_derive (conf->instance, "totals", "total_operations", "gzip",    val);
375
+		else if (strcmp(name, "n_gunzip") == 0)
376
+			return varnish_submit_derive (conf->instance, "totals", "total_operations", "gunzip",  val);
377
+	}
378
+
379
+	if (conf->collect_uptime)
380
+	{
381
+		if (strcmp(name, "uptime") == 0)
382
+			return varnish_submit_gauge (conf->instance, "uptime", "uptime", "client_uptime", val);
383
+	}
384
+
385
+	if (conf->collect_vcl)
386
+	{
387
+		if (strcmp(name, "n_vcl") == 0)
388
+			return varnish_submit_gauge (conf->instance, "vcl", "vcl", "total_vcl",     val);
389
+		else if (strcmp(name, "n_vcl_avail") == 0)
390
+			return varnish_submit_gauge (conf->instance, "vcl", "vcl", "avail_vcl",     val);
391
+		else if (strcmp(name, "n_vcl_discard") == 0)
392
+			return varnish_submit_gauge (conf->instance, "vcl", "vcl", "discarded_vcl", val);
393
+		else if (strcmp(name, "vmods") == 0)
394
+			return varnish_submit_gauge (conf->instance, "vcl", "objects", "vmod",      val);
395
+	}
396
+
397
+	if (conf->collect_workers)
398
+	{
399
+		if (strcmp(name, "threads") == 0)
400
+			return varnish_submit_gauge (conf->instance, "workers", "threads", "worker",               val);
401
+		else if (strcmp(name, "threads_created") == 0)
402
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "created",       val);
403
+		else if (strcmp(name, "threads_failed") == 0)
404
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "failed",        val);
405
+		else if (strcmp(name, "threads_limited") == 0)
406
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "limited",       val);
407
+		else if (strcmp(name, "threads_destroyed") == 0)
408
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped",       val);
409
+		else if (strcmp(name, "thread_queue_len") == 0)
410
+			return varnish_submit_derive (conf->instance, "workers", "queue_length",  "threads",       val);
411
+		else if (strcmp(name, "n_wrk") == 0)
412
+			return varnish_submit_gauge (conf->instance, "workers", "threads", "worker",               val);
413
+		else if (strcmp(name, "n_wrk_create") == 0)
414
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "created",       val);
415
+		else if (strcmp(name, "n_wrk_failed") == 0)
416
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "failed",        val);
417
+		else if (strcmp(name, "n_wrk_max") == 0)
418
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "limited",       val);
419
+		else if (strcmp(name, "n_wrk_drop") == 0)
420
+			return varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped",       val);
421
+		else if (strcmp(name, "n_wrk_queue") == 0)
422
+			return varnish_submit_derive (conf->instance, "workers", "total_requests", "queued",       val);
423
+		else if (strcmp(name, "n_wrk_overflow") == 0)
424
+			return varnish_submit_derive (conf->instance, "workers", "total_requests", "overflowed",   val);
425
+		else if (strcmp(name, "n_wrk_queued") == 0)
426
+			return varnish_submit_derive (conf->instance, "workers", "total_requests", "queued",       val);
427
+		else if (strcmp(name, "n_wrk_lqueue") == 0)
428
+			return varnish_submit_derive (conf->instance, "workers", "total_requests", "queue_length", val);
429
+	}
430
+
431
+#if HAVE_VARNISH_V4
432
+	if (conf->collect_vsm)
433
+	{
434
+		if (strcmp(name, "vsm_free") == 0)
435
+			return varnish_submit_gauge (conf->instance, "vsm", "bytes", "free",              val);
436
+		else if (strcmp(name, "vsm_used") == 0)
437
+			return varnish_submit_gauge (conf->instance, "vsm", "bytes", "used",              val);
438
+		else if (strcmp(name, "vsm_cooling") == 0)
439
+			return varnish_submit_gauge (conf->instance, "vsm", "bytes", "cooling",           val);
440
+		else if (strcmp(name, "vsm_overflow") == 0)
441
+			return varnish_submit_gauge (conf->instance, "vsm", "bytes", "overflow",          val);
442
+		else if (strcmp(name, "vsm_overflowed") == 0)
443
+			return varnish_submit_derive (conf->instance, "vsm", "total_bytes", "overflowed", val);
444
+	}
445
+#endif
446
+
447
+	return (0);
448
+
449
+} /* }}} static int varnish_monitor */
450
+#else /* if HAVE_VARNISH_V2 */
451
 static void varnish_monitor (const user_config_t *conf, /* {{{ */
452
 		const c_varnish_stats_t *stats)
453
 {
454
@@ -150,41 +541,20 @@ static void varnish_monitor (const user_
455
 
456
 	if (conf->collect_connections)
457
 	{
458
-#ifndef HAVE_VARNISH_V4
459
 		/* Client connections accepted */
460
 		varnish_submit_derive (conf->instance, "connections", "connections", "accepted", stats->client_conn);
461
 		/* Connection dropped, no sess */
462
 		varnish_submit_derive (conf->instance, "connections", "connections", "dropped" , stats->client_drop);
463
-#endif
464
 		/* Client requests received    */
465
 		varnish_submit_derive (conf->instance, "connections", "connections", "received", stats->client_req);
466
 	}
467
 
468
-#ifdef HAVE_VARNISH_V3
469
-	if (conf->collect_dirdns)
470
-	{
471
-		/* DNS director lookups */
472
-		varnish_submit_derive (conf->instance, "dirdns", "cache_operation", "lookups",    stats->dir_dns_lookups);
473
-		/* DNS director failed lookups */
474
-		varnish_submit_derive (conf->instance, "dirdns", "cache_result",    "failed",     stats->dir_dns_failed);
475
-		/* DNS director cached lookups hit */
476
-		varnish_submit_derive (conf->instance, "dirdns", "cache_result",    "hits",       stats->dir_dns_hit);
477
-		/* DNS director full dnscache */
478
-		varnish_submit_derive (conf->instance, "dirdns", "cache_result",    "cache_full", stats->dir_dns_cache_full);
479
-	}
480
-#endif
481
-
482
 	if (conf->collect_esi)
483
 	{
484
 		/* ESI parse errors (unlock)   */
485
 		varnish_submit_derive (conf->instance, "esi", "total_operations", "error",   stats->esi_errors);
486
-#if HAVE_VARNISH_V2
487
 		/* Objects ESI parsed (unlock) */
488
 		varnish_submit_derive (conf->instance, "esi", "total_operations", "parsed",  stats->esi_parse);
489
-#else
490
-		/* ESI parse warnings (unlock) */
491
-		varnish_submit_derive (conf->instance, "esi", "total_operations", "warning", stats->esi_warnings);
492
-#endif
493
 	}
494
 
495
 	if (conf->collect_backend)
496
@@ -203,13 +573,8 @@ static void varnish_monitor (const user_
497
 		varnish_submit_derive (conf->instance, "backend", "connections", "was-closed"   , stats->backend_toolate);
498
 		/* Backend conn. recycles      */
499
 		varnish_submit_derive (conf->instance, "backend", "connections", "recycled"     , stats->backend_recycle);
500
-#if HAVE_VARNISH_V2
501
 		/* Backend conn. unused        */
502
 		varnish_submit_derive (conf->instance, "backend", "connections", "unused"       , stats->backend_unused);
503
-#else
504
-		/* Backend conn. retry         */
505
-		varnish_submit_derive (conf->instance, "backend", "connections", "retries"      , stats->backend_retry);
506
-#endif
507
 		/* Backend requests mades      */
508
 		varnish_submit_derive (conf->instance, "backend", "http_requests", "requests"   , stats->backend_req);
509
 		/* N backends                  */
510
@@ -236,14 +601,6 @@ static void varnish_monitor (const user_
511
 		varnish_submit_derive (conf->instance, "fetch", "http_requests", "zero"       , stats->fetch_zero);
512
 		/* Fetch failed              */
513
 		varnish_submit_derive (conf->instance, "fetch", "http_requests", "failed"     , stats->fetch_failed);
514
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
515
-		/* Fetch no body (1xx)       */
516
-		varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_1xx", stats->fetch_1xx);
517
-		/* Fetch no body (204)       */
518
-		varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_204", stats->fetch_204);
519
-		/* Fetch no body (304)       */
520
-		varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_304", stats->fetch_304);
521
-#endif
522
 	}
523
 
524
 	if (conf->collect_hcb)
525
@@ -262,32 +619,22 @@ static void varnish_monitor (const user_
526
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "expired",            stats->n_expired);
527
 		/* N LRU nuked objects           */
528
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_nuked",          stats->n_lru_nuked);
529
-#if HAVE_VARNISH_V2
530
 		/* N LRU saved objects           */
531
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_saved",          stats->n_lru_saved);
532
-#endif
533
 		/* N LRU moved objects           */
534
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_moved",          stats->n_lru_moved);
535
-#if HAVE_VARNISH_V2
536
 		/* N objects on deathrow         */
537
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "deathrow",           stats->n_deathrow);
538
-#endif
539
 		/* HTTP header overflows         */
540
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "header_overflow",    stats->losthdr);
541
-#if HAVE_VARNISH_V4
542
-		/* N purged objects              */
543
-		varnish_submit_derive (conf->instance, "objects", "total_objects", "purged",             stats->n_obj_purged);
544
-#else
545
 		/* Objects sent with sendfile    */
546
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_sendfile",      stats->n_objsendfile);
547
 		/* Objects sent with write       */
548
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_write",         stats->n_objwrite);
549
 		/* Objects overflowing workspace */
550
 		varnish_submit_derive (conf->instance, "objects", "total_objects", "workspace_overflow", stats->n_objoverflow);
551
-#endif
552
 	}
553
 
554
-#if HAVE_VARNISH_V2
555
 	if (conf->collect_purge)
556
 	{
557
 		/* N total active purges      */
558
@@ -303,45 +650,6 @@ static void varnish_monitor (const user_
559
 		/* N duplicate purges removed */
560
 		varnish_submit_derive (conf->instance, "purge", "total_operations", "duplicate",        stats->n_purge_dups);
561
 	}
562
-#endif
563
-#if HAVE_VARNISH_V3
564
-	if (conf->collect_ban)
565
-	{
566
-		/* N total active bans      */
567
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "total",          stats->n_ban);
568
-		/* N new bans added         */
569
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "added",          stats->n_ban_add);
570
-		/* N old bans deleted       */
571
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted",        stats->n_ban_retire);
572
-		/* N objects tested         */
573
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "objects_tested", stats->n_ban_obj_test);
574
-		/* N regexps tested against */
575
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "regexps_tested", stats->n_ban_re_test);
576
-		/* N duplicate bans removed */
577
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate",      stats->n_ban_dups);
578
-	}
579
-#endif
580
-#if HAVE_VARNISH_V4
581
-	if (conf->collect_ban)
582
-	{
583
-		/* N total active bans      */
584
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "total",          stats->bans);
585
-		/* N new bans added         */
586
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "added",          stats->bans_added);
587
-		/* N bans using obj */
588
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "obj",            stats->bans_obj);
589
-		/* N bans using req */
590
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "req",            stats->bans_req);
591
-		/* N new bans completed     */
592
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "completed",      stats->bans_completed);
593
-		/* N old bans deleted       */
594
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted",        stats->bans_deleted);
595
-		/* N objects tested         */
596
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "tested",         stats->bans_tested);
597
-		/* N duplicate bans removed */
598
-		varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate",      stats->bans_dups);
599
-	}
600
-#endif
601
 
602
 	if (conf->collect_session)
603
 	{
604
@@ -351,21 +659,8 @@ static void varnish_monitor (const user_
605
 		varnish_submit_derive (conf->instance, "session", "total_operations", "pipeline",  stats->sess_pipeline);
606
 		/* Session Read Ahead */
607
 		varnish_submit_derive (conf->instance, "session", "total_operations", "readahead", stats->sess_readahead);
608
-#if HAVE_VARNISH_V4
609
-		/* Sessions accepted */
610
-		varnish_submit_derive (conf->instance, "session", "total_operations", "accepted",  stats->sess_conn);
611
-		/* Sessions dropped for thread */
612
-		varnish_submit_derive (conf->instance, "session", "total_operations", "dropped",   stats->sess_drop);
613
-		/* Sessions accept failure */
614
-		varnish_submit_derive (conf->instance, "session", "total_operations", "failed",    stats->sess_fail);
615
-		/* Sessions pipe overflow */
616
-		varnish_submit_derive (conf->instance, "session", "total_operations", "overflow",  stats->sess_pipe_overflow);
617
-		/* Sessions queued for thread */
618
-		varnish_submit_derive (conf->instance, "session", "total_operations", "queued",    stats->sess_queued);
619
-#else
620
 		/* Session Linger     */
621
 		varnish_submit_derive (conf->instance, "session", "total_operations", "linger",    stats->sess_linger);
622
-#endif
623
 		/* Session herd       */
624
 		varnish_submit_derive (conf->instance, "session", "total_operations", "herd",      stats->sess_herd);
625
 	}
626
@@ -384,7 +679,6 @@ static void varnish_monitor (const user_
627
 		varnish_submit_derive (conf->instance, "shm", "total_operations", "cycles"    , stats->shm_cycles);
628
 	}
629
 
630
-#if HAVE_VARNISH_V2
631
 	if (conf->collect_sm)
632
 	{
633
 		/* allocator requests */
634
@@ -410,7 +704,6 @@ static void varnish_monitor (const user_
635
 		/* SMA bytes free */
636
 		varnish_submit_derive (conf->instance,  "sma", "total_bytes", "free" ,     stats->sma_bfree);
637
 	}
638
-#endif
639
 
640
 	if (conf->collect_sms)
641
 	{
642
@@ -428,25 +721,14 @@ static void varnish_monitor (const user_
643
 
644
 	if (conf->collect_struct)
645
 	{
646
-#if !HAVE_VARNISH_V4
647
 		/* N struct sess_mem       */
648
 		varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess_mem",  stats->n_sess_mem);
649
 		/* N struct sess           */
650
 		varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess",      stats->n_sess);
651
-#endif
652
 		/* N struct object         */
653
 		varnish_submit_gauge (conf->instance, "struct", "objects", "object",             stats->n_object);
654
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
655
-		/* N unresurrected objects */
656
-		varnish_submit_gauge (conf->instance, "struct", "objects", "vampireobject",      stats->n_vampireobject);
657
-		/* N struct objectcore     */
658
-		varnish_submit_gauge (conf->instance, "struct", "objects", "objectcore",         stats->n_objectcore);
659
-		/* N struct waitinglist    */
660
-		varnish_submit_gauge (conf->instance, "struct", "objects", "waitinglist",        stats->n_waitinglist);
661
-#endif
662
 		/* N struct objecthead     */
663
 		varnish_submit_gauge (conf->instance, "struct", "objects", "objecthead",         stats->n_objecthead);
664
-#ifdef HAVE_VARNISH_V2
665
 		/* N struct smf            */
666
 		varnish_submit_gauge (conf->instance, "struct", "objects", "smf",                stats->n_smf);
667
 		/* N small free smf         */
668
@@ -455,7 +737,6 @@ static void varnish_monitor (const user_
669
 		varnish_submit_gauge (conf->instance, "struct", "objects", "smf_large",          stats->n_smf_large);
670
 		/* N struct vbe_conn        */
671
 		varnish_submit_gauge (conf->instance, "struct", "objects", "vbe_conn",           stats->n_vbe_conn);
672
-#endif
673
 	}
674
 
675
 	if (conf->collect_totals)
676
@@ -470,47 +751,12 @@ static void varnish_monitor (const user_
677
 		varnish_submit_derive (conf->instance, "totals", "total_operations", "pass",    stats->s_pass);
678
 		/* Total fetch */
679
 		varnish_submit_derive (conf->instance, "totals", "total_operations", "fetches", stats->s_fetch);
680
-#if HAVE_VARNISH_V4
681
-		/* Total synth */
682
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "synth",       stats->s_synth);
683
-		/* Request header bytes */
684
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_header",  stats->s_req_hdrbytes);
685
-		/* Request body byte */
686
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_body",    stats->s_req_bodybytes);
687
-		/* Response header bytes */
688
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_header", stats->s_resp_hdrbytes);
689
-		/* Response body byte */
690
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_body",   stats->s_resp_bodybytes);
691
-		/* Pipe request header bytes */
692
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_header", stats->s_pipe_hdrbytes);
693
-		/* Piped bytes from client */
694
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_in",     stats->s_pipe_in);
695
-		/* Piped bytes to client */
696
-		varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_out",    stats->s_pipe_out);
697
-		/* Number of purge operations */
698
-		varnish_submit_derive (conf->instance, "totals", "total_operations", "purges", stats->n_purges);
699
-#else
700
 		/* Total header bytes */
701
 		varnish_submit_derive (conf->instance, "totals", "total_bytes", "header-bytes", stats->s_hdrbytes);
702
 		/* Total body byte */
703
 		varnish_submit_derive (conf->instance, "totals", "total_bytes", "body-bytes",   stats->s_bodybytes);
704
-#endif
705
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
706
-		/* Gzip operations */
707
-		varnish_submit_derive (conf->instance, "totals", "total_operations", "gzip",    stats->n_gzip);
708
-		/* Gunzip operations */
709
-		varnish_submit_derive (conf->instance, "totals", "total_operations", "gunzip",  stats->n_gunzip);
710
-#endif
711
 	}
712
 
713
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
714
-	if (conf->collect_uptime)
715
-	{
716
-		/* Client uptime */
717
-		varnish_submit_gauge (conf->instance, "uptime", "uptime", "client_uptime", stats->uptime);
718
-	}
719
-#endif
720
-
721
 	if (conf->collect_vcl)
722
 	{
723
 		/* N vcl total     */
724
@@ -519,28 +765,10 @@ static void varnish_monitor (const user_
725
 		varnish_submit_gauge (conf->instance, "vcl", "vcl", "avail_vcl",     stats->n_vcl_avail);
726
 		/* N vcl discarded */
727
 		varnish_submit_gauge (conf->instance, "vcl", "vcl", "discarded_vcl", stats->n_vcl_discard);
728
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
729
-		/* Loaded VMODs */
730
-		varnish_submit_gauge (conf->instance, "vcl", "objects", "vmod",      stats->vmods);
731
-#endif
732
 	}
733
 
734
 	if (conf->collect_workers)
735
 	{
736
-#ifdef HAVE_VARNISH_V4
737
-		/* total number of threads */
738
-		varnish_submit_gauge (conf->instance, "workers", "threads", "worker",             stats->threads);
739
-		/* threads created */
740
-		varnish_submit_derive (conf->instance, "workers", "total_threads", "created",     stats->threads_created);
741
-		/* thread creation failed */
742
-		varnish_submit_derive (conf->instance, "workers", "total_threads", "failed",      stats->threads_failed);
743
-		/* threads hit max */
744
-		varnish_submit_derive (conf->instance, "workers", "total_threads", "limited",     stats->threads_limited);
745
-		/* threads destroyed */
746
-		varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped",     stats->threads_destroyed);
747
-		/* length of session queue */
748
-		varnish_submit_derive (conf->instance, "workers", "queue_length",  "threads",     stats->thread_queue_len);
749
-#else
750
 		/* worker threads */
751
 		varnish_submit_gauge (conf->instance, "workers", "threads", "worker",             stats->n_wrk);
752
 		/* worker threads created */
753
@@ -551,37 +779,14 @@ static void varnish_monitor (const user_
754
 		varnish_submit_derive (conf->instance, "workers", "total_threads", "limited",     stats->n_wrk_max);
755
 		/* dropped work requests */
756
 		varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped",     stats->n_wrk_drop);
757
-#ifdef HAVE_VARNISH_V2
758
 		/* queued work requests */
759
 		varnish_submit_derive (conf->instance, "workers", "total_requests", "queued",     stats->n_wrk_queue);
760
 		/* overflowed work requests */
761
 		varnish_submit_derive (conf->instance, "workers", "total_requests", "overflowed", stats->n_wrk_overflow);
762
-#else /* HAVE_VARNISH_V3 */
763
-		/* queued work requests */
764
-		varnish_submit_derive (conf->instance, "workers", "total_requests", "queued",       stats->n_wrk_queued);
765
-		/* work request queue length */
766
-		varnish_submit_derive (conf->instance, "workers", "total_requests", "queue_length", stats->n_wrk_lqueue);
767
-#endif
768
-#endif
769
-	}
770
-
771
-#if HAVE_VARNISH_V4
772
-	if (conf->collect_vsm)
773
-	{
774
-		/* Free VSM space */
775
-		varnish_submit_gauge (conf->instance, "vsm", "bytes", "free",              stats->vsm_free);
776
-		/* Used VSM space */
777
-		varnish_submit_gauge (conf->instance, "vsm", "bytes", "used",              stats->vsm_used);
778
-		/* Cooling VSM space */
779
-		varnish_submit_gauge (conf->instance, "vsm", "bytes", "cooling",           stats->vsm_cooling);
780
-		/* Overflow VSM space */
781
-		varnish_submit_gauge (conf->instance, "vsm", "bytes", "overflow",          stats->vsm_overflow);
782
-		/* Total overflowed VSM space */
783
-		varnish_submit_derive (conf->instance, "vsm", "total_bytes", "overflowed", stats->vsm_overflowed);
784
 	}
785
-#endif
786
 
787
 } /* }}} void varnish_monitor */
788
+#endif
789
 
790
 #if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
791
 static int varnish_read (user_data_t *ud) /* {{{ */
792
@@ -632,8 +837,12 @@ static int varnish_read (user_data_t *ud
793
 	stats = VSC_Main(vd, NULL);
794
 #endif
795
 
796
-	varnish_monitor (conf, stats);
797
-	VSM_Close (vd);
798
+#if HAVE_VARNISH_V3
799
+	VSC_Iter (vd, varnish_monitor, conf);
800
+#else /* if HAVE_VARNISH_V4 */
801
+	VSC_Iter (vd, NULL, varnish_monitor, conf);
802
+#endif
803
+        VSM_Delete (vd);
804
 
805
 	return (0);
806
 } /* }}} */
(-)net-mgmt/collectd5.new/files/patch-src_disk.c (-341 / +1 lines)
Lines 1-4 Link Here
1
--- src/disk.c.orig	2015-03-10 14:14:45 UTC
1
--- src/disk.c.orig	2016-01-22 09:51:17 UTC
2
+++ src/disk.c
2
+++ src/disk.c
3
@@ -53,6 +53,10 @@
3
@@ -53,6 +53,10 @@
4
 #if HAVE_IOKIT_IOBSD_H
4
 #if HAVE_IOKIT_IOBSD_H
Lines 43-385 Link Here
43
 #elif HAVE_LIBKSTAT
43
 #elif HAVE_LIBKSTAT
44
 	kstat_t *ksp_chain;
44
 	kstat_t *ksp_chain;
45
 
45
 
46
@@ -395,173 +417,223 @@ static int disk_read (void)
47
 	io_registry_entry_t	disk;
48
 	io_registry_entry_t	disk_child;
49
 	io_iterator_t		disk_list;
50
-	CFDictionaryRef		props_dict;
51
+	CFMutableDictionaryRef	props_dict, child_dict;
52
 	CFDictionaryRef		stats_dict;
53
-	CFDictionaryRef		child_dict;
54
 	CFStringRef		tmp_cf_string_ref;
55
 	kern_return_t		status;
56
 
57
-	signed long long read_ops;
58
-	signed long long read_byt;
59
-	signed long long read_tme;
60
-	signed long long write_ops;
61
-	signed long long write_byt;
62
-	signed long long write_tme;
63
+	signed long long read_ops, read_byt, read_tme;
64
+	signed long long write_ops, write_byt, write_tme;
65
 
66
-	int  disk_major;
67
-	int  disk_minor;
68
+	int  disk_major, disk_minor;
69
 	char disk_name[DATA_MAX_NAME_LEN];
70
-	char disk_name_bsd[DATA_MAX_NAME_LEN];
71
+	char child_disk_name_bsd[DATA_MAX_NAME_LEN], props_disk_name_bsd[DATA_MAX_NAME_LEN];
72
 
73
 	/* Get the list of all disk objects. */
74
-	if (IOServiceGetMatchingServices (io_master_port,
75
-				IOServiceMatching (kIOBlockStorageDriverClass),
76
-				&disk_list) != kIOReturnSuccess)
77
-	{
78
+	if (IOServiceGetMatchingServices (io_master_port, IOServiceMatching (kIOBlockStorageDriverClass), &disk_list) != kIOReturnSuccess) {
79
 		ERROR ("disk plugin: IOServiceGetMatchingServices failed.");
80
 		return (-1);
81
 	}
82
 
83
-	while ((disk = IOIteratorNext (disk_list)) != 0)
84
-	{
85
+	while ((disk = IOIteratorNext (disk_list)) != 0) {
86
 		props_dict = NULL;
87
 		stats_dict = NULL;
88
 		child_dict = NULL;
89
 
90
-		/* `disk_child' must be released */
91
-		if ((status = IORegistryEntryGetChildEntry (disk, kIOServicePlane, &disk_child))
92
-			       	!= kIOReturnSuccess)
93
-		{
94
-			/* This fails for example for DVD/CD drives.. */
95
+		/* get child of disk entry and corresponding property dictionary */
96
+		if ((status = IORegistryEntryGetChildEntry (disk, kIOServicePlane, &disk_child)) != kIOReturnSuccess) {
97
+			/* This fails for example for DVD/CD drives, which we want to ignore anyway */
98
 			DEBUG ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
99
 			IOObjectRelease (disk);
100
 			continue;
101
 		}
102
-
103
-		/* We create `props_dict' => we need to release it later */
104
-		if (IORegistryEntryCreateCFProperties (disk,
105
-					(CFMutableDictionaryRef *) &props_dict,
106
-					kCFAllocatorDefault,
107
-					kNilOptions)
108
-				!= kIOReturnSuccess)
109
-		{
110
-			ERROR ("disk-plugin: IORegistryEntryCreateCFProperties failed.");
111
+		if (IORegistryEntryCreateCFProperties (disk_child, (CFMutableDictionaryRef *) &child_dict, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess || child_dict == NULL) {
112
+			ERROR ("disk plugin: IORegistryEntryCreateCFProperties (disk_child) failed.");
113
 			IOObjectRelease (disk_child);
114
 			IOObjectRelease (disk);
115
 			continue;
116
 		}
117
 
118
-		if (props_dict == NULL)
119
-		{
120
-			DEBUG ("IORegistryEntryCreateCFProperties (disk) failed.");
121
-			IOObjectRelease (disk_child);
122
-			IOObjectRelease (disk);
123
-			continue;
124
+		/* extract name and major/minor numbers */
125
+		memset (child_disk_name_bsd, 0, sizeof (child_disk_name_bsd));
126
+		tmp_cf_string_ref = (CFStringRef) CFDictionaryGetValue (child_dict, CFSTR(kIOBSDNameKey));
127
+		if (tmp_cf_string_ref) {
128
+			assert (CFGetTypeID (tmp_cf_string_ref) == CFStringGetTypeID ());
129
+			CFStringGetCString (tmp_cf_string_ref, child_disk_name_bsd, sizeof (child_disk_name_bsd), kCFStringEncodingUTF8);
130
 		}
131
+		disk_major = (int) dict_get_value (child_dict, kIOBSDMajorKey);
132
+		disk_minor = (int) dict_get_value (child_dict, kIOBSDMinorKey);
133
+		DEBUG ("disk plugin: child_disk_name_bsd=\"%s\" major=%d minor=%d", child_disk_name_bsd, disk_major, disk_minor);
134
+		CFRelease (child_dict);
135
+		IOObjectRelease (disk_child);
136
 
137
-		/* tmp_cf_string_ref doesn't need to be released. */
138
-		tmp_cf_string_ref = (CFStringRef) CFDictionaryGetValue (props_dict,
139
-				CFSTR(kIOBSDNameKey));
140
-		if (!tmp_cf_string_ref)
141
-		{
142
-			DEBUG ("disk plugin: CFDictionaryGetValue("
143
-					"kIOBSDNameKey) failed.");
144
-			CFRelease (props_dict);
145
-			IOObjectRelease (disk_child);
146
+		/* get property dictionary of the disk entry itself */
147
+		if (IORegistryEntryCreateCFProperties (disk, (CFMutableDictionaryRef *) &props_dict, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess || props_dict == NULL) {
148
+			ERROR ("disk-plugin: IORegistryEntryCreateCFProperties failed.");
149
 			IOObjectRelease (disk);
150
 			continue;
151
 		}
152
-		assert (CFGetTypeID (tmp_cf_string_ref) == CFStringGetTypeID ());
153
 
154
-		memset (disk_name_bsd, 0, sizeof (disk_name_bsd));
155
-		CFStringGetCString (tmp_cf_string_ref,
156
-				disk_name_bsd, sizeof (disk_name_bsd),
157
-				kCFStringEncodingUTF8);
158
-		if (disk_name_bsd[0] == 0)
159
-		{
160
-			ERROR ("disk plugin: CFStringGetCString() failed.");
161
-			CFRelease (props_dict);
162
-			IOObjectRelease (disk_child);
163
-			IOObjectRelease (disk);
164
-			continue;
165
+		/* extract name and stats dictionary */
166
+		memset (props_disk_name_bsd, 0, sizeof (props_disk_name_bsd));
167
+		tmp_cf_string_ref = (CFStringRef) CFDictionaryGetValue (props_dict, CFSTR(kIOBSDNameKey));
168
+		if (tmp_cf_string_ref) {
169
+			assert (CFGetTypeID (tmp_cf_string_ref) == CFStringGetTypeID ());
170
+			CFStringGetCString (tmp_cf_string_ref, props_disk_name_bsd, sizeof (props_disk_name_bsd), kCFStringEncodingUTF8);
171
 		}
172
-		DEBUG ("disk plugin: disk_name_bsd = \"%s\"", disk_name_bsd);
173
-
174
-		stats_dict = (CFDictionaryRef) CFDictionaryGetValue (props_dict,
175
-				CFSTR (kIOBlockStorageDriverStatisticsKey));
176
-
177
-		if (stats_dict == NULL)
178
-		{
179
-			DEBUG ("disk plugin: CFDictionaryGetValue ("
180
-					"%s) failed.",
181
-				       	kIOBlockStorageDriverStatisticsKey);
182
+		stats_dict = (CFDictionaryRef) CFDictionaryGetValue (props_dict, CFSTR (kIOBlockStorageDriverStatisticsKey));
183
+		if (stats_dict == NULL) {
184
+			ERROR ("disk plugin: CFDictionaryGetValue (%s) failed.", kIOBlockStorageDriverStatisticsKey);
185
 			CFRelease (props_dict);
186
-			IOObjectRelease (disk_child);
187
 			IOObjectRelease (disk);
188
 			continue;
189
 		}
190
+		DEBUG ("disk plugin: props_disk_name_bsd=\"%s\"", props_disk_name_bsd);
191
 
192
-		if (IORegistryEntryCreateCFProperties (disk_child,
193
-					(CFMutableDictionaryRef *) &child_dict,
194
-					kCFAllocatorDefault,
195
-					kNilOptions)
196
-				!= kIOReturnSuccess)
197
-		{
198
-			DEBUG ("disk plugin: IORegistryEntryCreateCFProperties ("
199
-					"disk_child) failed.");
200
-			IOObjectRelease (disk_child);
201
-			CFRelease (props_dict);
202
-			IOObjectRelease (disk);
203
-			continue;
204
+		/* choose name */
205
+		if (use_bsd_name) {
206
+			if (child_disk_name_bsd[0] != 0)
207
+				sstrncpy (disk_name, child_disk_name_bsd, sizeof (disk_name));
208
+			else if (props_disk_name_bsd[0] != 0)
209
+				sstrncpy (disk_name, props_disk_name_bsd, sizeof (disk_name));
210
+			else {
211
+				ERROR ("disk plugin: can't find bsd disk name.");
212
+				ssnprintf (disk_name, sizeof (disk_name), "%i-%i", disk_major, disk_minor);
213
+			}
214
 		}
215
+		else
216
+			ssnprintf (disk_name, sizeof (disk_name), "%i-%i", disk_major, disk_minor);
217
 
218
-		/* kIOBSDNameKey */
219
-		disk_major = (int) dict_get_value (child_dict,
220
-			       	kIOBSDMajorKey);
221
-		disk_minor = (int) dict_get_value (child_dict,
222
-			       	kIOBSDMinorKey);
223
-		read_ops  = dict_get_value (stats_dict,
224
-				kIOBlockStorageDriverStatisticsReadsKey);
225
-		read_byt  = dict_get_value (stats_dict,
226
-				kIOBlockStorageDriverStatisticsBytesReadKey);
227
-		read_tme  = dict_get_value (stats_dict,
228
-				kIOBlockStorageDriverStatisticsTotalReadTimeKey);
229
-		write_ops = dict_get_value (stats_dict,
230
-				kIOBlockStorageDriverStatisticsWritesKey);
231
-		write_byt = dict_get_value (stats_dict,
232
-				kIOBlockStorageDriverStatisticsBytesWrittenKey);
233
-		/* This property describes the number of nanoseconds spent
234
-		 * performing writes since the block storage driver was
235
-		 * instantiated. It is one of the statistic entries listed
236
-		 * under the top-level kIOBlockStorageDriverStatisticsKey
237
-		 * property table. It has an OSNumber value. */
238
-		write_tme = dict_get_value (stats_dict,
239
-				kIOBlockStorageDriverStatisticsTotalWriteTimeKey);
240
+		/* extract the stats */
241
+		read_ops  = dict_get_value (stats_dict, kIOBlockStorageDriverStatisticsReadsKey);
242
+		read_byt  = dict_get_value (stats_dict, kIOBlockStorageDriverStatisticsBytesReadKey);
243
+		read_tme  = dict_get_value (stats_dict, kIOBlockStorageDriverStatisticsTotalReadTimeKey);
244
+		write_ops = dict_get_value (stats_dict, kIOBlockStorageDriverStatisticsWritesKey);
245
+		write_byt = dict_get_value (stats_dict, kIOBlockStorageDriverStatisticsBytesWrittenKey);
246
+		write_tme = dict_get_value (stats_dict, kIOBlockStorageDriverStatisticsTotalWriteTimeKey);
247
+		CFRelease (props_dict);
248
+		IOObjectRelease (disk);
249
 
250
-		if (use_bsd_name)
251
-			sstrncpy (disk_name, disk_name_bsd, sizeof (disk_name));
252
-		else
253
-			ssnprintf (disk_name, sizeof (disk_name), "%i-%i",
254
-					disk_major, disk_minor);
255
+		/* and submit */
256
 		DEBUG ("disk plugin: disk_name = \"%s\"", disk_name);
257
-
258
 		if ((read_byt != -1LL) || (write_byt != -1LL))
259
 			disk_submit (disk_name, "disk_octets", read_byt, write_byt);
260
 		if ((read_ops != -1LL) || (write_ops != -1LL))
261
 			disk_submit (disk_name, "disk_ops", read_ops, write_ops);
262
 		if ((read_tme != -1LL) || (write_tme != -1LL))
263
-			disk_submit (disk_name, "disk_time",
264
-					read_tme / 1000,
265
-					write_tme / 1000);
266
+			disk_submit (disk_name, "disk_time", read_tme / 1000, write_tme / 1000);
267
 
268
-		CFRelease (child_dict);
269
-		IOObjectRelease (disk_child);
270
-		CFRelease (props_dict);
271
-		IOObjectRelease (disk);
272
 	}
273
 	IOObjectRelease (disk_list);
274
 /* #endif HAVE_IOKIT_IOKITLIB_H */
275
 
276
+#elif KERNEL_FREEBSD
277
+	int retry, dirty;
278
+
279
+	void *snap = NULL;
280
+	struct devstat *snap_iter;
281
+
282
+	struct gident *geom_id;
283
+
284
+	const char *disk_name;
285
+	long double read_time, write_time;
286
+
287
+	for (retry = 0, dirty = 1; retry < 5 && dirty == 1; retry++) {
288
+		if (snap != NULL)
289
+			geom_stats_snapshot_free(snap);
290
+
291
+		/* Get a fresh copy of stats snapshot */
292
+		snap = geom_stats_snapshot_get();
293
+		if (snap == NULL) {
294
+			ERROR("disk plugin: geom_stats_snapshot_get() failed.");
295
+			return (-1);
296
+		}
297
+
298
+		/* Check if we have dirty read from this snapshot */
299
+		dirty = 0;
300
+		geom_stats_snapshot_reset(snap);
301
+		while ((snap_iter = geom_stats_snapshot_next(snap)) != NULL) {
302
+			if (snap_iter->id == NULL)
303
+				continue;
304
+			geom_id = geom_lookupid(&geom_tree, snap_iter->id);
305
+
306
+			/* New device? refresh GEOM tree */
307
+			if (geom_id == NULL) {
308
+				geom_deletetree(&geom_tree);
309
+				if (geom_gettree(&geom_tree) != 0) {
310
+					ERROR("disk plugin: geom_gettree() failed");
311
+					geom_stats_snapshot_free(snap);
312
+					return (-1);
313
+				}
314
+				geom_id = geom_lookupid(&geom_tree, snap_iter->id);
315
+			}
316
+			/*
317
+			 * This should be rare: the device come right before we take the
318
+			 * snapshot and went away right after it.  We will handle this
319
+			 * case later, so don't mark dirty but silently ignore it.
320
+			 */
321
+			if (geom_id == NULL)
322
+				continue;
323
+
324
+			/* Only collect PROVIDER data */
325
+			if (geom_id->lg_what != ISPROVIDER)
326
+				continue;
327
+
328
+			/* Only collect data when rank is 1 (physical devices) */
329
+			if (((struct gprovider *)(geom_id->lg_ptr))->lg_geom->lg_rank != 1)
330
+				continue;
331
+
332
+			/* Check if this is a dirty read quit for another try */
333
+			if (snap_iter->sequence0 != snap_iter->sequence1) {
334
+				dirty = 1;
335
+				break;
336
+			}
337
+		}
338
+	}
339
+
340
+	/* Reset iterator */
341
+	geom_stats_snapshot_reset(snap);
342
+	for (;;) {
343
+		snap_iter = geom_stats_snapshot_next(snap);
344
+		if (snap_iter == NULL)
345
+			break;
346
+
347
+		if (snap_iter->id == NULL)
348
+			continue;
349
+		geom_id = geom_lookupid(&geom_tree, snap_iter->id);
350
+		if (geom_id == NULL)
351
+			continue;
352
+		if (geom_id->lg_what != ISPROVIDER)
353
+			continue;
354
+		if (((struct gprovider *)(geom_id->lg_ptr))->lg_geom->lg_rank != 1)
355
+			continue;
356
+		/* Skip dirty reads, if present */
357
+		if (dirty && (snap_iter->sequence0 != snap_iter->sequence1))
358
+			continue;
359
+
360
+		disk_name = ((struct gprovider *)geom_id->lg_ptr)->lg_name;
361
+
362
+		if ((snap_iter->bytes[1] != 0) || (snap_iter->bytes[2] != 0)) {
363
+			disk_submit(disk_name, "disk_octets",
364
+					(derive_t)snap_iter->bytes[1],
365
+					(derive_t)snap_iter->bytes[2]);
366
+		}
367
+
368
+		if ((snap_iter->operations[1] != 0) || (snap_iter->operations[2] != 0)) {
369
+			disk_submit(disk_name, "disk_ops",
370
+					(derive_t)snap_iter->operations[1],
371
+					(derive_t)snap_iter->operations[2]);
372
+		}
373
+
374
+		read_time = devstat_compute_etime(&snap_iter->duration[DEVSTAT_READ], NULL);
375
+		write_time = devstat_compute_etime(&snap_iter->duration[DEVSTAT_WRITE], NULL);
376
+		if ((read_time != 0) || (write_time != 0)) {
377
+			disk_submit (disk_name, "disk_time",
378
+					(derive_t)(read_time*1000), (derive_t)(write_time*1000));
379
+		}
380
+	}
381
+	geom_stats_snapshot_free(snap);
382
+
383
 #elif KERNEL_LINUX
384
 	FILE *fh;
385
 	char buffer[1024];
(-)net-mgmt/collectd5.new/files/patch-src_zfs__arc.c (+14 lines)
Line 0 Link Here
1
--- src/zfs_arc.c.orig	2016-01-22 09:51:17 UTC
2
+++ src/zfs_arc.c
3
@@ -270,8 +270,11 @@ static int za_read (void)
4
 	za_read_derive (ksp, "deleted",  "cache_operation", "deleted");
5
 #if __FreeBSD__
6
 	za_read_derive (ksp, "allocated","cache_operation", "allocated");
7
+#if defined(__FreeBSD_version) && (__FreeBSD_version < 1002000)
8
+	/* stolen removed from sysctl kstat.zfs.misc.arcstats on FreeBSD 10.2+ */
9
 	za_read_derive (ksp, "stolen",   "cache_operation", "stolen");
10
 #endif
11
+#endif
12
 
13
 	/* Issue indicators */
14
 	za_read_derive (ksp, "mutex_miss", "mutex_operations", "miss");
(-)net-mgmt/collectd5.new/files/patch-version-gen.sh (-3 / +3 lines)
Lines 1-9 Link Here
1
--- version-gen.sh.orig	2015-05-26 20:23:28 UTC
1
--- version-gen.sh.orig	2016-01-22 09:51:17 UTC
2
+++ version-gen.sh
2
+++ version-gen.sh
3
@@ -1,13 +1,3 @@
3
@@ -1,13 +1,3 @@
4
 #!/bin/sh
4
 #!/bin/sh
5
 
5
 
6
-DEFAULT_VERSION="5.5.0.git"
6
-DEFAULT_VERSION="5.5.1.git"
7
-
7
-
8
-VERSION="`git describe 2> /dev/null | grep collectd | sed -e 's/^collectd-//'`"
8
-VERSION="`git describe 2> /dev/null | grep collectd | sed -e 's/^collectd-//'`"
9
-
9
-
Lines 14-17 Link Here
14
-VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
14
-VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
15
-
15
-
16
-printf "%s" "$VERSION"
16
-printf "%s" "$VERSION"
17
+echo -n "5.5.0.git"
17
+echo -n "5.5.1.git"
(-)net-mgmt/collectd5.new/pkg-plist (-1 lines)
Lines 30-36 Link Here
30
lib/collectd/dns.so
30
lib/collectd/dns.so
31
lib/collectd/email.so
31
lib/collectd/email.so
32
lib/collectd/exec.so
32
lib/collectd/exec.so
33
lib/collectd/fhcount.so
34
lib/collectd/filecount.so
33
lib/collectd/filecount.so
35
%%STATGRAB%%lib/collectd/interface.so
34
%%STATGRAB%%lib/collectd/interface.so
36
%%IPMI%%lib/collectd/ipmi.so
35
%%IPMI%%lib/collectd/ipmi.so

Return to bug 206660