1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

- Update net-mgmt/collectd5 to 5.4.0 (by me)

- Convert to the new options layout like net-mgmt/collectd (by maintainer: Krzysztof Stryjek <ports@bsdserwis.com>)
- Clean up some options and simplify the CONFIGURE_ARGS (by swills@)

PR:		181443
Submitted by:	brd@
Reviewed by:	swills@
Approved by:	Krzysztof Stryjek <ports@bsdserwis.com> (maintainer)
This commit is contained in:
Brad Davis 2013-09-13 01:32:38 +00:00
parent 27713e1c50
commit d1cfa261c4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=327125
7 changed files with 185 additions and 327 deletions

View File

@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= collectd
PORTVERSION= 5.3.0
PORTREVISION= 4
PORTVERSION= 5.4.0
CATEGORIES= net-mgmt
MASTER_SITES= http://collectd.org/files/
@ -13,11 +12,17 @@ COMMENT= Systems & network statistics collection daemon
USES= gmake pkgconfig
USE_BZIP2= yes
GNU_CONFIGURE= yes
USE_AUTOTOOLS= autoconf autoheader automake libltdl
USE_AUTOTOOLS= aclocal autoconf autoheader automake libltdl libtool
USE_GNOME= glib20
LATEST_LINK= collectd5
OPTIONS_DEFINE= CGI CURL DEBUG DBI GCRYPT JSON MEMCACHEC MODBUS MYSQL NOTIFYEMAIL NUTUPS PGSQL PING PYTHON REDIS ROUTEROS RRDTOOL SNMP STATGRAB TOKYOTYRANT VIRT XML XMMS
OPTIONS_DEFINE= CGI DEBUG GCRYPT VIRT
OPTIONS_GROUP= INPUT OUTPUT
OPTIONS_GROUP_OUTPUT= RRDTOOL NOTIFYEMAIL NOTIFYDESKTOP
OPTIONS_GROUP_INPUT= CURL DBI JSON MEMCACHEC MODBUS MYSQL \
NUTUPS PGSQL PING PYTHON RABBITMQ REDIS \
ROUTEROS SNMP STATGRAB TOKYOTYRANT XML XMMS
CGI_DESC= Install collection.cgi (requires rrdtool)
CURL_DESC= Enable curl-based plugins (apache, nginx, etc)
@ -27,12 +32,14 @@ GCRYPT_DESC= Build with libgcrypt
JSON_DESC= Enable JSON plugins
MEMCACHEC_DESC= Enable memcachec plugin
MODBUS_DESC= Enable modbus plugin
NOTIFYEMAIL_DESC= Mail notification
MYSQL_DESC= Enable mysql-based plugins
NOTIFYEMAIL_DESC= Enable notifications via email
NOTIFYDESKTOP_DESC= Enable desktop notifications
NUTUPS_DESC= Enable nut (ups) plugin
PGSQL_DESC= Enable postgresql-based plugins
PING_DESC= Enable ping plugin
PYTHON_DESC= Enable python-based plugins
RABBITMQ_DESC= Enable rabbitmq-based plugins
REDIS_DESC= Enable redis-based plugins
ROUTEROS_DESC= Enable routeros plugin
RRDTOOL_DESC= Enable rrdtool plugin (also rrdcached plugin)
@ -64,42 +71,22 @@ CONFIGURE_ARGS= --localstatedir=/var \
--disable-getifaddrs \
--disable-static \
--without-java \
--without-libcredis \
--without-libcurl \
--without-libdbi \
--without-libesmtp \
--without-libganglia \
--without-libgcrypt \
--without-libiptc \
--without-libjvm \
--without-libkstat \
--without-libmemcached \
--without-libmodbus \
--without-libmongoc \
--without-libmysql \
--without-libnetlink \
--without-libnetapp \
--without-libnetsnmp \
--without-libnotify \
--without-libopenipmi \
--without-liboping \
--without-libowcapi \
--without-libperfstat \
--without-libperl \
--without-libpq \
--without-librabbitmq \
--without-librouteros \
--without-librrd \
--without-libsensors \
--without-libstatgrab \
--without-libtokyotyrant \
--without-libupsclient \
--without-libvarnish \
--without-libvirt \
--without-libxmms \
--without-libyajl \
--without-oracle \
--without-perl-bindings \
--without-perl-bindings
# NOTE: Plugins without external dependencies
CONFIGURE_ARGS+= \
@ -144,7 +131,6 @@ CONFIGURE_ARGS+= \
--enable-threshold \
--enable-unixsock \
--enable-uptime \
--enable-users \
--enable-uuid \
--enable-write_graphite \
--enable-zfs_arc
@ -171,6 +157,11 @@ CONFIGURE_ARGS+=--with-libcurl=${LOCALBASE} \
--enable-write_http
PLIST_SUB+= CURL=""
.else
CONFIGURE_ARGS+=--without-libcurl \
--disable-apache \
--disable-curl \
--disable-nginx \
--disable-write_http
PLIST_SUB+= CURL="@comment "
.endif
@ -178,6 +169,7 @@ PLIST_SUB+= CURL="@comment "
CONFIGURE_ARGS+=--enable-curl_json
PLIST_SUB+= CURL_JSON=""
.else
CONFIGURE_ARGS+=--disable-curl_json
PLIST_SUB+= CURL_JSON="@comment "
.endif
@ -188,11 +180,17 @@ CONFIGURE_ARGS+= \
--enable-curl_xml
PLIST_SUB+= CURL_XML=""
.else
CONFIGURE_ARGS+= \
--disable-ascent \
--disable-bind \
--disable-curl_xml
PLIST_SUB+= CURL_XML="@comment "
.endif
.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=--enable-debug
.else
CONFIGURE_ARGS+=--disable-debug
.endif
.if ${PORT_OPTIONS:MDBI}
@ -200,6 +198,7 @@ LIB_DEPENDS+= dbi:${PORTSDIR}/databases/libdbi
CONFIGURE_ARGS+=--with-libdbi=${LOCALBASE} --enable-dbi
PLIST_SUB+= DBI=""
.else
CONFIGURE_ARGS+=--without-libdbi --disable-dbi
PLIST_SUB+= DBI="@comment "
.endif
@ -207,11 +206,15 @@ PLIST_SUB+= DBI="@comment "
LIB_DEPENDS+= gcrypt:${PORTSDIR}/security/libgcrypt
CONFIGURE_ARGS+=--with-libgcrypt=${LOCALBASE}
LDFLAGS+= -lgcrypt
.else
CONFIGURE_ARGS+=--without-libgcrypt
.endif
.if ${PORT_OPTIONS:MJSON}
LIB_DEPENDS+= yajl:${PORTSDIR}/devel/yajl
CONFIGURE_ARGS+=--with-libyajl=${LOCALBASE}
.else
CONFIGURE_ARGS+=--without-libyajl
.endif
.if ${PORT_OPTIONS:MMEMCACHEC}
@ -219,6 +222,7 @@ LIB_DEPENDS+= memcached:${PORTSDIR}/databases/libmemcached
CONFIGURE_ARGS+=--with-libmemcached=${LOCALBASE} --enable-memcachec
PLIST_SUB+= MEMCACHEC=""
.else
CONFIGURE_ARGS+=--without-libmemcached
PLIST_SUB+= MEMCACHEC="@comment "
.endif
@ -235,17 +239,27 @@ USE_MYSQL= yes
CONFIGURE_ARGS+=--with-libmysql=${LOCALBASE} --enable-mysql
PLIST_SUB+= MYSQL=""
.else
CONFIGURE_ARGS+=--without-libmysql --disable-mysql
PLIST_SUB+= MYSQL="@comment "
.endif
.if ${PORT_OPTIONS:MNOTIFYDESKTOP}
LIB_DEPENDS+= notify:${PORTSDIR}/devel/libnotify
CONFIGURE_ARGS+=--with-libnotify=${LOCALBASE} \
--enable-notify_desktop
PLIST_SUB+= NOTIFYDESKTOP=""
.else
CONFIGURE_ARGS+=--without-libnotify --disable-notify_desktop
PLIST_SUB+= NOTIFYDESKTOP="@comment "
.endif
.if ${PORT_OPTIONS:MNOTIFYEMAIL}
LIB_DEPENDS+= esmtp:${PORTSDIR}/mail/libesmtp
LIB_DEPENDS+= notify:${PORTSDIR}/devel/libnotify
CONFIGURE_ARGS+=--with-libesmtp=${LOCALBASE} \
--with-libnotify=${LOCALBASE} \
--enable-notify_email
PLIST_SUB+= NOTIFYEMAIL=""
.else
CONFIGURE_ARGS+=--without-libesmtp --disable-notify_email
PLIST_SUB+= NOTIFYEMAIL="@comment "
.endif
@ -254,6 +268,7 @@ LIB_DEPENDS+= upsclient:${PORTSDIR}/sysutils/nut
CONFIGURE_ARGS+=--with-upsclient=${LOCALBASE} --enable-nut
PLIST_SUB+= NUTUPS=""
.else
CONFIGURE_ARGS+=--without-libupsclient --disable-nut
PLIST_SUB+= NUTUPS="@comment "
.endif
@ -262,6 +277,7 @@ USE_PGSQL= yes
CONFIGURE_ARGS+=--with-postgresql=${LOCALBASE} --enable-postgresql --with-libpq
PLIST_SUB+= PGSQL=""
.else
CONFIGURE_ARGS+=--without-postgresql --disable-postgresql --without-libpq
PLIST_SUB+= PGSQL="@comment "
.endif
@ -270,6 +286,7 @@ LIB_DEPENDS+= oping:${PORTSDIR}/net/liboping
CONFIGURE_ARGS+=--with-liboping=${LOCALBASE} --enable-ping
PLIST_SUB+= PING=""
.else
CONFIGURE_ARGS+=--without-liboping --disable-ping
PLIST_SUB+= PING="@comment "
.endif
@ -278,9 +295,21 @@ USE_PYTHON= yes
CONFIGURE_ARGS+=--with-python=${PYTHON_CMD} --enable-python
PLIST_SUB+= PYTHON=""
.else
CONFIGURE_ARGS+=--without-python
CONFIGURE_ARGS+=--without-python --disable-python
PLIST_SUB+= PYTHON="@comment "
.endif
.if ${PORT_OPTIONS:MRABBITMQ}
LIB_DEPENDS+= rabbitmq:${PORTSDIR}/net/rabbitmq-c
CONFIGURE_ARGS+=--with-librabbitmq=${LOCALBASE} \
--enable-rabbitmq
PLIST_SUB+= RABBITMQ=""
.else
CONFIGURE_ARGS+=--without-librabbitmq \
--disable-rabbitmq
PLIST_SUB+= RABBITMQ="@comment "
.endif
.if ${PORT_OPTIONS:MREDIS}
LIB_DEPENDS+= credis:${PORTSDIR}/databases/credis
CONFIGURE_ARGS+=--with-libcredis=${LOCALBASE} \
@ -288,6 +317,9 @@ CONFIGURE_ARGS+=--with-libcredis=${LOCALBASE} \
--enable-write_redis
PLIST_SUB+= REDIS=""
.else
CONFIGURE_ARGS+=--without-libcredis \
--disable-redis \
--disable-write_redis
PLIST_SUB+= REDIS="@comment "
.endif
@ -296,6 +328,7 @@ LIB_DEPENDS+= routeros:${PORTSDIR}/net/librouteros
CONFIGURE_ARGS+=--with-librouteros=${LOCALBASE} --enable-routeros
PLIST_SUB+= ROUTEROS=""
.else
CONFIGURE_ARGS+=--without-librouteros --disable-routeros
PLIST_SUB+= ROUTEROS="@comment "
.endif
@ -306,6 +339,9 @@ CONFIGURE_ARGS+=--with-librrd=${LOCALBASE} \
--enable-rrdtool
PLIST_SUB+= RRDTOOL=""
.else
CONFIGURE_ARGS+=--without-librrd \
--disable-rrdcached \
--disable-rrdtool
PLIST_SUB+= RRDTOOL="@comment "
.endif
@ -318,14 +354,26 @@ CONFIGURE_ARGS+=--with-libstatgrab=${LOCALBASE} \
--enable-interface
PLIST_SUB+= STATGRAB=""
.else
CONFIGURE_ARGS+=--without-libstatgrab
PLIST_SUB+= STATGRAB="@comment "
.endif
.if ${OSVERSION} >= 900007
CONFIGURE_ARGS+=--enable-users
PLIST_SUB+= USERS=""
.elif ${PORT_OPTIONS:MSTATGRAB}
CONFIGURE_ARGS+=--enable-users
PLIST_SUB+= USERS=""
.else
PLIST_SUB+= USERS="@comment "
.endif
.if ${PORT_OPTIONS:MSNMP}
LIB_DEPENDS+= netsnmp:${PORTSDIR}/net-mgmt/net-snmp
CONFIGURE_ARGS+=--with-libnetsnmp --enable-snmp
PLIST_SUB+= SNMP=""
.else
CONFIGURE_ARGS+=--without-libnetsnmp
PLIST_SUB+= SNMP="@comment "
.endif
@ -334,17 +382,19 @@ LIB_DEPENDS+= tokyotyrant:${PORTSDIR}/databases/tokyotyrant
CONFIGURE_ARGS+=--with-libtokyotyrant=${LOCALBASE} --enable-tokyotyrant
PLIST_SUB+= TOKYOTYRANT=""
.else
CONFIGURE_ARGS+=--without-libtokyotyrant --disable-tokyotyrant
PLIST_SUB+= TOKYOTYRANT="@comment "
.endif
.if ${PORT_OPTIONS:MVIRT}
LIB_DEPENDS+= virt.1001:${PORTSDIR}/devel/libvirt
CONFIGURE_ARGS+=--enable-libvirt
.if empty(PORT_OPTIONS:MXML)
IGNORE= VIRT requires XML. Either select XML or deselect VIRT.
.endif
LIB_DEPENDS+= virt.1001:${PORTSDIR}/devel/libvirt
CONFIGURE_ARGS+=--enable-libvirt
PLIST_SUB+= VIRT=""
.else
CONFIGURE_ARGS+=--without-libvirt --disable-libvirt
PLIST_SUB+= VIRT="@comment "
.endif
@ -359,6 +409,7 @@ CONFIGURE_ARGS+=--with-libxmms=${LOCALBASE} --enable-xmms
CFLAGS+= `xmms-config --cflags`
PLIST_SUB+= XMMS=""
.else
CONFIGURE_ARGS+=--without-libxmms --disable-xmms
PLIST_SUB+= XMMS="@comment "
.endif

View File

@ -1,2 +1,2 @@
SHA256 (collectd-5.3.0.tar.bz2) = 5b04150f3c79f90f1a610ed22a2287ef5d8a07dcc2d0fa7a6a650edd9dc1ea01
SIZE (collectd-5.3.0.tar.bz2) = 1501308
SHA256 (collectd-5.4.0.tar.bz2) = 90973894a1f10775d409fe23ce7bc4d89c1b7c6f4d9918b305d160605871923e
SIZE (collectd-5.4.0.tar.bz2) = 1506520

View File

@ -1,16 +1,6 @@
--- ./configure.in.orig 2013-05-21 21:43:30.000000000 +0000
+++ ./configure.in 2013-05-21 21:43:14.000000000 +0000
@@ -74,6 +74,9 @@
*openbsd*)
ac_system="OpenBSD"
;;
+ *freebsd*)
+ ac_system="FreeBSD"
+ ;;
*aix*)
AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
ac_system="AIX"
@@ -106,7 +109,7 @@
--- configure.in.orig 2013-08-18 04:24:25.049973000 -0600
+++ configure.in 2013-08-19 10:46:53.000000000 -0600
@@ -110,7 +110,7 @@
fi
# Where to install .pc files.
@ -19,7 +9,7 @@
AC_SUBST(pkgconfigdir)
# Check for standards compliance mode
@@ -1413,6 +1416,7 @@
@@ -1419,6 +1419,7 @@
then
AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
fi
@ -27,7 +17,7 @@
if test "x$with_kstat" = "xyes"
then
AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
@@ -1422,6 +1426,8 @@
@@ -1428,6 +1429,8 @@
then
AC_DEFINE(HAVE_LIBKSTAT, 1,
[Define to 1 if you have the 'kstat' library (-lkstat)])
@ -36,7 +26,7 @@
fi
AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
@@ -1841,12 +1847,6 @@
@@ -1904,12 +1907,6 @@
AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
[with_libgcrypt="yes"],
[with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
@ -49,7 +39,7 @@
fi
CPPFLAGS="$SAVE_CPPFLAGS"
@@ -3408,7 +3408,7 @@
@@ -3454,7 +3451,7 @@
if test "x$with_python" = "xyes"
then
AC_MSG_CHECKING([for Python LIBS])
@ -58,7 +48,7 @@
python_config_status=$?
if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
@@ -3423,7 +3423,7 @@
@@ -3469,7 +3466,7 @@
if test "x$with_python" = "xyes"
then
LDFLAGS="-L$python_library_path $LDFLAGS"
@ -67,7 +57,7 @@
AC_CHECK_FUNC(PyObject_CallFunction,
[with_python="yes"],
@@ -4168,7 +4168,7 @@
@@ -4339,7 +4336,7 @@
then
AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
with_libvarnish_cflags="-I$withval/include"
@ -76,28 +66,3 @@
with_libvarnish="yes"
fi; fi; fi
],
@@ -4693,6 +4693,12 @@
plugin_zfs_arc="yes"
fi
+# FreeBSD
+if test "x$have_struct_kinfo_proc_freebsd" = "xyes"
+then
+ plugin_zfs_arc="yes"
+fi
+
if test "x$with_devinfo$with_kstat" = "xyesyes"
then
plugin_cpu="yes"
@@ -4866,6 +4872,12 @@
plugin_users="yes"
fi
+# FreeBSD
+if test "x$have_struct_kinfo_proc_freebsd" = "xyes"
+then
+ plugin_zfs_arc="yes"
+fi
+
m4_divert_once([HELP_ENABLE], [
collectd plugins:])

View File

@ -1,5 +1,5 @@
--- ./src/Makefile.am.orig 2013-04-10 15:34:36.000000000 +0000
+++ ./src/Makefile.am 2013-05-21 23:57:02.000000000 +0000
--- src/Makefile.am.orig 2013-08-18 04:24:25.061973000 -0600
+++ src/Makefile.am 2013-08-20 21:34:14.000000000 -0600
@@ -10,7 +10,7 @@
AM_CPPFLAGS = -DPREFIX='"${prefix}"'
AM_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
@ -18,7 +18,7 @@
endif
if BUILD_WITH_LIBDEVINFO
collectd_LDADD += -ldevinfo
@@ -257,7 +257,7 @@
@@ -275,7 +275,7 @@
cpu_la_LDFLAGS = -module -avoid-version
cpu_la_LIBADD =
if BUILD_WITH_LIBKSTAT
@ -27,7 +27,7 @@
endif
if BUILD_WITH_LIBDEVINFO
cpu_la_LIBADD += -ldevinfo
@@ -355,7 +355,7 @@
@@ -373,7 +373,7 @@
disk_la_LDFLAGS = -module -avoid-version
disk_la_LIBADD =
if BUILD_WITH_LIBKSTAT
@ -36,7 +36,7 @@
endif
if BUILD_WITH_LIBDEVINFO
disk_la_LIBADD += -ldevinfo
@@ -462,7 +462,7 @@
@@ -480,7 +480,7 @@
interface_la_LIBADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
else
if BUILD_WITH_LIBKSTAT
@ -45,7 +45,7 @@
endif
if BUILD_WITH_LIBDEVINFO
interface_la_LIBADD += -ldevinfo
@@ -667,7 +667,7 @@
@@ -694,7 +694,7 @@
collectd_LDADD += "-dlopen" memory.la
collectd_DEPENDENCIES += memory.la
if BUILD_WITH_LIBKSTAT
@ -54,7 +54,7 @@
endif
if BUILD_WITH_LIBDEVINFO
memory_la_LIBADD += -ldevinfo
@@ -796,7 +796,7 @@
@@ -823,7 +823,7 @@
pkglib_LTLIBRARIES += notify_email.la
notify_email_la_SOURCES = notify_email.c
notify_email_la_LDFLAGS = -module -avoid-version
@ -63,7 +63,7 @@
collectd_LDADD += "-dlopen" notify_email.la
collectd_DEPENDENCIES += notify_email.la
endif
@@ -1061,7 +1061,7 @@
@@ -1108,7 +1108,7 @@
collectd_LDADD += "-dlopen" swap.la
collectd_DEPENDENCIES += swap.la
if BUILD_WITH_LIBKSTAT
@ -72,7 +72,7 @@
endif
if BUILD_WITH_LIBDEVINFO
swap_la_LIBADD += -ldevinfo
@@ -1115,7 +1115,7 @@
@@ -1162,7 +1162,7 @@
pkglib_LTLIBRARIES += tape.la
tape_la_SOURCES = tape.c
tape_la_LDFLAGS = -module -avoid-version
@ -81,7 +81,7 @@
collectd_LDADD += "-dlopen" tape.la
collectd_DEPENDENCIES += tape.la
endif
@@ -1238,7 +1238,7 @@
@@ -1285,7 +1285,7 @@
uptime_la_LDFLAGS = -module -avoid-version
uptime_la_LIBADD =
if BUILD_WITH_LIBKSTAT
@ -90,16 +90,7 @@
endif
if BUILD_WITH_PERFSTAT
uptime_la_LIBADD += -lperfstat
@@ -1375,7 +1375,7 @@
zfs_arc_la_SOURCES = zfs_arc.c
zfs_arc_la_CFLAGS = $(AM_CFLAGS)
zfs_arc_la_LDFLAGS = -module -avoid-version
-zfs_arc_la_LIBADD = -lkstat
+zfs_arc_la_LIBADD = $(BUILD_WITH_LIBKSTAT_LIBS)
collectd_LDADD += "-dlopen" zfs_arc.la
collectd_DEPENDENCIES += zfs_arc.la
endif
@@ -1458,12 +1458,7 @@
@@ -1519,12 +1519,7 @@
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)

View File

@ -1,220 +0,0 @@
diff --git src/zfs_arc.c src/zfs_arc.c
index aa90019..17e8513 100644
--- src/zfs_arc.c
+++ src/zfs_arc.c
@@ -19,6 +19,8 @@
* Authors:
* Anthony Dewhurst <dewhurst at gmail>
* Aurelien Rougemont <beorn at gandi.net>
+ * Brad Davis <brd at FreeBSD.org>
+ * William Grzybowski <william88 at gmail>
**/
#include "collectd.h"
@@ -29,7 +31,14 @@
* Global variables
*/
+#if defined(HAVE_LIBKSTAT)
+static kstat_t *ksp;
extern kstat_ctl_t *kc;
+#elif defined(HAVE_SYSCTLBYNAME)
+ typedef void kstat_t;
+# include <sys/types.h>
+# include <sys/sysctl.h>
+#endif /* HAVE_SYSCTLBYNAME */
static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
{
@@ -57,37 +66,56 @@ static void za_submit_gauge (const char* type, const char* type_instance, gauge_
static int za_read_derive (kstat_t *ksp, const char *kstat_value,
const char *type, const char *type_instance)
{
- long long tmp;
- value_t v;
-
- tmp = get_kstat_value (ksp, (char *)kstat_value);
- if (tmp == -1LL)
- {
- ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
- return (-1);
- }
-
- v.derive = (derive_t) tmp;
- za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
- return (0);
+ long long tmp;
+ value_t v;
+
+#if defined(HAVE_LIBKSTAT)
+ tmp = get_kstat_value (ksp, (char *)kstat_value);
+ if (tmp == -1LL)
+ {
+ ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
+ return (-1);
+ }
+#elif defined(HAVE_SYSCTLBYNAME)
+ size_t size;
+ size = sizeof(tmp);
+ if (sysctlbyname(kstat_value, &tmp, &size, NULL, 0) < 0) {
+ ERROR ("zfs_arc plugin: Reading sysctl \"%s\" failed.", kstat_value);
+ return (-1);
+ }
+#endif /* HAVE_LIBKSTAT */
+
+ v.derive = (derive_t) tmp;
+ za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
+ return (0);
}
static int za_read_gauge (kstat_t *ksp, const char *kstat_value,
const char *type, const char *type_instance)
{
- long long tmp;
- value_t v;
-
- tmp = get_kstat_value (ksp, (char *)kstat_value);
- if (tmp == -1LL)
- {
- ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
- return (-1);
- }
-
- v.gauge = (gauge_t) tmp;
- za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
- return (0);
+ long long tmp;
+ value_t v;
+
+#if defined(HAVE_LIBKSTAT)
+ tmp = get_kstat_value (ksp, (char *)kstat_value);
+ if (tmp == -1LL)
+ {
+ ERROR ("zfs_arc plugin: Reading kstat value \"%s\" failed.", kstat_value);
+ return (-1);
+ }
+
+#elif defined(HAVE_SYSCTLBYNAME)
+ size_t size;
+ size = sizeof(tmp);
+ if (sysctlbyname(kstat_value, &tmp, &size, NULL, 0) < 0) {
+ ERROR ("zfs_arc plugin: Reading sysctl \"%s\" failed.", kstat_value);
+ return (-1);
+ }
+#endif /* HAVE_LIBKSTAT */
+
+ v.gauge = (gauge_t) tmp;
+ za_submit (type, type_instance, /* values = */ &v, /* values_num = */ 1);
+ return (0);
}
static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t misses)
@@ -105,11 +133,67 @@ static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t mi
za_submit_gauge ("cache_ratio", type_instance, ratio);
}
-static int za_read (void)
+#if defined(HAVE_SYSCTLBYNAME)
+static int za_read_freebsd (void)
+{
+ // Sizes
+ za_read_gauge (NULL, "kstat.zfs.misc.arcstats.size", "cache_size", "arc");
+ za_read_gauge (NULL, "kstat.zfs.misc.arcstats.l2_size", "cache_size", "L2");
+
+ /* Operations */
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.allocated", "cache_operation", "allocated");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.deleted", "cache_operation", "deleted");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.stolen", "cache_operation", "stolen");
+
+ /* Issue indicators */
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.mutex_miss", "mutex_operation", "miss");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.hash_collisions", "hash_collisions", "");
+
+ /* Evictions */
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.evict_l2_cached", "cache_eviction", "cached");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.evict_l2_eligible", "cache_eviction", "eligible");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.evict_l2_ineligible", "cache_eviction", "ineligible");
+
+ /* Hits / misses */
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_data_hits", "cache_result", "demand_data-hit");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_metadata_hits", "cache_result", "demand_metadata-hit");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_data_hits", "cache_result", "prefetch_data-hit");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_metadata_hits", "cache_result", "prefetch_metadata-hit");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_data_misses", "cache_result", "demand_data-miss");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.demand_metadata_misses", "cache_result", "demand_metadata-miss");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_data_misses", "cache_result", "prefetch_data-miss");
+ za_read_derive (NULL, "kstat.zfs.misc.arcstats.prefetch_metadata_misses", "cache_result", "prefetch_metadata-miss");
+
+ /* Ratios */
+ gauge_t arc_hits;
+ gauge_t arc_misses;
+ gauge_t l2_hits;
+ gauge_t l2_misses;
+ value_t l2_io[2];
+
+ size_t size;
+ size = sizeof(arc_hits);
+ sysctlbyname("kstat.zfs.misc.arcstats.hits", &arc_hits, &size, NULL, 0);
+ sysctlbyname("kstat.zfs.misc.arcstats.misses", &arc_misses, &size, NULL, 0);
+ sysctlbyname("kstat.zfs.misc.arcstats.l2_hits", &l2_hits, &size, NULL, 0);
+ sysctlbyname("kstat.zfs.misc.arcstats.l2_misses", &l2_misses, &size, NULL, 0);
+
+ za_submit_ratio ("arc", arc_hits, arc_misses);
+ za_submit_ratio ("L2", l2_hits, l2_misses);
+
+ /* I/O */
+ sysctlbyname("kstat.zfs.misc.arcstats.l2_read_bytes", &l2_io[0].derive, &size, NULL, 0);
+ sysctlbyname("kstat.zfs.misc.arcstats.l2_write_bytes", &l2_io[1].derive, &size, NULL, 0);
+
+ za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
+
+ return (0);
+}
+#elif defined(HAVE_LIBKSTAT)
+static int za_read_solaris (void)
{
gauge_t arc_hits, arc_misses, l2_hits, l2_misses;
value_t l2_io[2];
- kstat_t *ksp = NULL;
get_kstat (&ksp, "zfs", 0, "arcstats");
if (ksp == NULL)
@@ -163,15 +247,20 @@ static int za_read (void)
return (0);
} /* int za_read */
+#endif
static int za_init (void) /* {{{ */
{
+#if defined(HAVE_LIBKSTAT)
+ ksp = NULL;
+
/* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */
if (kc == NULL)
{
ERROR ("zfs_arc plugin: kstat chain control structure not available.");
return (-1);
}
+#endif /* HAVE_LIBKSTAT */
return (0);
} /* }}} int za_init */
@@ -179,7 +268,16 @@ static int za_init (void) /* {{{ */
void module_register (void)
{
plugin_register_init ("zfs_arc", za_init);
- plugin_register_read ("zfs_arc", za_read);
+
+#if defined(HAVE_LIBKSTAT)
+ plugin_register_read ("zfs_arc", za_read_solaris);
+#elif defined(HAVE_SYSCTLBYNAME)
+ plugin_register_read ("zfs_arc", za_read_freebsd);
+#else
+ ERROR ("Unable to determine which OS we are on");
+ return (-1);
+#endif /* HAVE_SYSCTLBYNAME */
+
} /* void module_register */
/* vmi: set sw=8 noexpandtab fdm=marker : */

View File

@ -1,9 +1,10 @@
--- ./version-gen.sh.orig 2013-05-21 21:22:23.000000000 +0000
+++ ./version-gen.sh 2013-05-21 21:23:19.000000000 +0000
--- version-gen.sh.orig 2013-08-19 10:57:47.000000000 -0600
+++ version-gen.sh 2013-08-19 10:58:15.000000000 -0600
@@ -1,13 +1,3 @@
-#!/usr/bin/env bash
-
-DEFAULT_VERSION="5.3.0.git"
+#!/bin/sh
-DEFAULT_VERSION="5.4.0.git"
-
-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
-
@ -12,7 +13,6 @@
-fi
-
-VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`"
+#!/bin/sh
-
-echo -n "$VERSION"
+echo -n "5.3.0.git"
+echo -n '5.4.0.git'

View File

@ -16,147 +16,218 @@ include/collectd/client.h
include/collectd/lcc_features.h
include/collectd/network.h
include/collectd/network_buffer.h
lib/collectd/aggregation.a
lib/collectd/aggregation.so
lib/collectd/aggregation.la
%%CURL%%lib/collectd/apache.a
%%CURL%%lib/collectd/apache.so
%%CURL%%lib/collectd/apache.la
lib/collectd/apcups.a
lib/collectd/apcups.so
lib/collectd/apcups.la
%%CURL_XML%%lib/collectd/ascent.a
%%CURL_XML%%lib/collectd/ascent.so
%%CURL_XML%%lib/collectd/ascent.la
%%CURL_XML%%lib/collectd/bind.a
%%CURL_XML%%lib/collectd/bind.so
%%CURL_XML%%lib/collectd/bind.la
lib/collectd/contextswitch.a
lib/collectd/contextswitch.so
lib/collectd/contextswitch.la
lib/collectd/cpu.a
lib/collectd/cpu.so
lib/collectd/cpu.la
lib/collectd/csv.a
lib/collectd/csv.so
lib/collectd/csv.la
%%CURL%%lib/collectd/curl.a
%%CURL%%lib/collectd/curl.so
%%CURL%%lib/collectd/curl.la
%%CURL_JSON%%lib/collectd/curl_json.a
%%CURL_JSON%%lib/collectd/curl_json.so
%%CURL_JSON%%lib/collectd/curl_json.la
%%CURL_XML%%lib/collectd/curl_xml.a
%%CURL_XML%%lib/collectd/curl_xml.so
%%CURL_XML%%lib/collectd/curl_xml.la
%%DBI%%lib/collectd/dbi.a
%%DBI%%lib/collectd/dbi.so
%%DBI%%lib/collectd/dbi.la
lib/collectd/df.a
lib/collectd/df.so
lib/collectd/df.la
%%STATGRAB%%lib/collectd/disk.a
%%STATGRAB%%lib/collectd/disk.so
%%STATGRAB%%lib/collectd/disk.la
lib/collectd/dns.a
lib/collectd/dns.so
lib/collectd/dns.la
lib/collectd/email.a
lib/collectd/email.so
lib/collectd/email.la
lib/collectd/exec.a
lib/collectd/exec.so
lib/collectd/exec.la
lib/collectd/filecount.a
lib/collectd/filecount.so
lib/collectd/filecount.la
%%STATGRAB%%lib/collectd/interface.a
%%STATGRAB%%lib/collectd/interface.so
%%STATGRAB%%lib/collectd/interface.la
lib/collectd/load.a
lib/collectd/load.so
lib/collectd/load.la
lib/collectd/logfile.a
lib/collectd/logfile.so
lib/collectd/logfile.la
lib/collectd/match_empty_counter.a
lib/collectd/match_empty_counter.so
lib/collectd/match_empty_counter.la
lib/collectd/match_hashed.a
lib/collectd/match_hashed.so
lib/collectd/match_hashed.la
lib/collectd/match_regex.a
lib/collectd/match_regex.so
lib/collectd/match_regex.la
lib/collectd/match_timediff.a
lib/collectd/match_timediff.so
lib/collectd/match_timediff.la
lib/collectd/match_value.a
lib/collectd/match_value.so
lib/collectd/match_value.la
lib/collectd/mbmon.a
lib/collectd/mbmon.so
lib/collectd/mbmon.la
%%MEMCACHEC%%lib/collectd/memcachec.a
%%MEMCACHEC%%lib/collectd/memcachec.so
%%MEMCACHEC%%lib/collectd/memcachec.la
lib/collectd/memcached.a
lib/collectd/memcached.so
lib/collectd/memcached.la
lib/collectd/memory.a
lib/collectd/memory.so
lib/collectd/memory.la
%%MYSQL%%lib/collectd/mysql.a
%%MYSQL%%lib/collectd/mysql.so
%%MYSQL%%lib/collectd/mysql.la
lib/collectd/network.a
lib/collectd/network.so
lib/collectd/network.la
%%CURL%%lib/collectd/nginx.a
%%CURL%%lib/collectd/nginx.so
%%CURL%%lib/collectd/nginx.la
lib/collectd/ntpd.a
lib/collectd/ntpd.so
lib/collectd/ntpd.la
%%NUTUPS%%lib/collectd/nut.a
%%NUTUPS%%lib/collectd/nut.so
%%NUTUPS%%lib/collectd/nut.la
lib/collectd/openvpn.a
lib/collectd/openvpn.so
lib/collectd/openvpn.la
%%PING%%lib/collectd/ping.a
%%PING%%lib/collectd/ping.so
%%PING%%lib/collectd/ping.la
%%PGSQL%%lib/collectd/postgresql.a
%%PGSQL%%lib/collectd/postgresql.so
%%PGSQL%%lib/collectd/postgresql.la
lib/collectd/powerdns.a
lib/collectd/powerdns.so
lib/collectd/powerdns.la
lib/collectd/pf.a
lib/collectd/pf.so
lib/collectd/pf.la
lib/collectd/processes.a
lib/collectd/processes.so
lib/collectd/processes.la
%%REDIS%%lib/collectd/redis.a
%%REDIS%%lib/collectd/redis.so
%%REDIS%%lib/collectd/redis.la
%%ROUTEROS%%lib/collectd/routeros.a
%%ROUTEROS%%lib/collectd/routeros.so
%%ROUTEROS%%lib/collectd/routeros.la
%%RRDTOOL%%lib/collectd/rrdcached.a
%%RRDTOOL%%lib/collectd/rrdcached.so
%%RRDTOOL%%lib/collectd/rrdcached.la
%%RRDTOOL%%lib/collectd/rrdtool.a
%%RRDTOOL%%lib/collectd/rrdtool.so
%%RRDTOOL%%lib/collectd/rrdtool.la
%%SNMP%%lib/collectd/snmp.a
%%SNMP%%lib/collectd/snmp.so
%%SNMP%%lib/collectd/snmp.la
lib/collectd/swap.a
lib/collectd/swap.so
lib/collectd/swap.la
lib/collectd/syslog.a
lib/collectd/syslog.so
lib/collectd/syslog.la
lib/collectd/table.a
lib/collectd/table.so
lib/collectd/table.la
lib/collectd/tail.a
lib/collectd/tail.so
lib/collectd/tail.la
lib/collectd/target_notification.a
lib/collectd/target_notification.so
lib/collectd/target_notification.la
lib/collectd/target_replace.a
lib/collectd/target_replace.so
lib/collectd/target_replace.la
lib/collectd/target_scale.a
lib/collectd/target_scale.so
lib/collectd/target_scale.la
lib/collectd/target_set.a
lib/collectd/target_set.so
lib/collectd/target_set.la
lib/collectd/target_v5upgrade.a
lib/collectd/target_v5upgrade.so
lib/collectd/target_v5upgrade.la
lib/collectd/tcpconns.a
lib/collectd/tcpconns.so
lib/collectd/tcpconns.la
lib/collectd/teamspeak2.a
lib/collectd/teamspeak2.so
lib/collectd/teamspeak2.la
lib/collectd/ted.a
lib/collectd/ted.so
lib/collectd/ted.la
lib/collectd/threshold.a
lib/collectd/threshold.so
lib/collectd/threshold.la
%%TOKYOTYRANT%%lib/collectd/tokyotyrant.a
%%TOKYOTYRANT%%lib/collectd/tokyotyrant.so
%%TOKYOTYRANT%%lib/collectd/tokyotyrant.la
lib/collectd/unixsock.a
lib/collectd/unixsock.so
lib/collectd/unixsock.la
lib/collectd/uptime.a
lib/collectd/uptime.so
lib/collectd/uptime.la
lib/collectd/users.so
lib/collectd/users.la
%%USERS%%lib/collectd/users.a
%%USERS%%lib/collectd/users.so
%%USERS%%lib/collectd/users.la
lib/collectd/uuid.a
lib/collectd/uuid.so
lib/collectd/uuid.la
%%VIRT%%lib/collectd/libvirt.a
%%VIRT%%lib/collectd/libvirt.so
%%VIRT%%lib/collectd/libvirt.la
lib/collectd/write_graphite.a
lib/collectd/write_graphite.so
lib/collectd/write_graphite.la
%%CURL%%lib/collectd/write_http.a
%%CURL%%lib/collectd/write_http.so
%%CURL%%lib/collectd/write_http.la
%%REDIS%%lib/collectd/write_redis.a
%%REDIS%%lib/collectd/write_redis.so
%%REDIS%%lib/collectd/write_redis.la
%%XMMS%%lib/collectd/xmms.a
%%XMMS%%lib/collectd/xmms.so
%%XMMS%%lib/collectd/xmms.la
lib/collectd/zfs_arc.a
lib/collectd/zfs_arc.so
lib/collectd/zfs_arc.la
lib/libcollectdclient.la
lib/libcollectdclient.a
lib/libcollectdclient.so
lib/libcollectdclient.so.1
libdata/pkgconfig/libcollectdclient.pc