Landry, thanks for your comments!
Sorry for the unreadable diff, hope this time it's better.

> > Maybe, but those cosmetic changes should be separate, otherwise the diff
> > is unreadable. Unless someone beats me to it, i'll definitely look
> > deeper into it next month.. (yeah, sorry), but USE_LIBTOOL shouldnt be
> > needed iirc, and so far for new dependencies if they tended to be 'big'

Collectd uses "--export-symbols-regex '\<module_register\>'" libtool option
during modules build, and OpenBSD's libtool silently ignores it.

> > (for various definitions of big) we put the corresponding plugins in a
> > subpackage like it's done for the others.

I dont't consider these new dependencies big (for example, we have curl
module in the main package which requires libcurl); 
devel/libyajl dependency is shared between curl_json and log_logstash
modules, so I decided to add yajl to the main build; devel/protobuf-c is
also not a big dependency from my point of view, but if you think I'm
wrong, it's not a big deal to move it to the separate package.

> And i also think there were reasons for running collectd as root instead
> of a dedicated use (kvm access? setuidsomething?) but i cant remember
> them now... you'll also need to provide an upgrade path for existing
> setups if you want to move to a dedicated user, and adapt the config
> maybe ?

Fixed. You are right, dns and ping modules require root, so I've added the
README explaining this and the command to make collectd run as non-priv user,
if these modules are not used. Also added simple "chgrp _collectd
/etc/collectd.conf; chmod g+r /etc/collectd.conf" to the rc script to
keep it running whenever it runs as root or as _collectd. 

-- 
With best regards,
Pavel Korovin
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/collectd/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- Makefile    3 May 2015 10:41:34 -0000       1.28
+++ Makefile    5 Jun 2015 13:52:56 -0000
@@ -10,7 +10,7 @@ COMMENT-python =      collectd python plugin
 COMMENT-memcachec =    collectd memcachec plugin
 COMMENT-nut =          collectd nut plugin
 
-V =                    5.4.2
+V =                    5.5.0
 DISTNAME =             collectd-$V
 PKGNAME-main =         collectd-$V
 PKGNAME-mysql =                collectd-mysql-$V
@@ -82,12 +82,16 @@ LIB_DEPENDS +=      net/curl \
                textproc/libxml \
                sysutils/libstatgrab \
                security/libgcrypt \
-               devel/libtool,-ltdl
+               devel/libtool,-ltdl \
+               devel/libyajl \
+               devel/protobuf-c>=1.0.1
 
 WANTLIB += c crypto gpg-error idn kvm curl xml2 ltdl lzma oping
 WANTLIB += m pcap pthread ssl xml2 z statgrab gcrypt ${MODGETTEXT_WANTLIB}
+WANTLIB += protobuf-c yajl
 
 CONFIGURE_STYLE =      gnu
+USE_LIBTOOL=           gnu
 LIBTOOL_FLAGS =        --tag=disable-static
 CONFIGURE_ARGS +=--with-ltdl-include=${LOCALBASE}/include \
                --with-ltdl-lib=${LOCALBASE}/lib \
@@ -108,7 +112,9 @@ ENABLED_PLUGINS =   apache apcups ascent b
                        processes rrdtool rrdcached snmp swap syslog table tail 
tail_csv \
                        target_notification target_replace target_scale \
                        target_set target_v5upgrade tcpconns teamspeak2 ted 
unixsock uptime \
-                       users uuid write_http write_graphite pf python libvirt 
memcachec nut
+                       users uuid write_http write_graphite pf python virt 
memcachec nut \
+                       aggregation curl_json fhcount log_logstash memcached \
+                       threshold write_log write_riemann
 
 .for _plugin in ${ENABLED_PLUGINS}
 CONFIGURE_ARGS += --enable-${_plugin}
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/collectd/distinfo,v
retrieving revision 1.5
diff -u -p -r1.5 distinfo
--- distinfo    3 May 2015 10:41:34 -0000       1.5
+++ distinfo    5 Jun 2015 13:52:56 -0000
@@ -1,2 +1,2 @@
-SHA256 (collectd-5.4.2.tar.gz) = l3gIDunuZ2xxMLHOhsKEPHNZ4pub0cHA5I/NnMzwies=
-SIZE (collectd-5.4.2.tar.gz) = 2024679
+SHA256 (collectd-5.5.0.tar.gz) = X3z61bJO1PixE8+ycOD55an3w68QRDy1B/1AF0pskCg=
+SIZE (collectd-5.5.0.tar.gz) = 2244454
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/sysutils/collectd/patches/patch-configure,v
retrieving revision 1.7
diff -u -p -r1.7 patch-configure
--- patches/patch-configure     3 May 2015 10:41:35 -0000       1.7
+++ patches/patch-configure     5 Jun 2015 13:52:56 -0000
@@ -1,20 +1,9 @@
 $OpenBSD: patch-configure,v 1.7 2015/05/03 10:41:35 landry Exp $
 no Werror, breaks with gcrypt deprecation warnings
 dont check for pcap-bpf.h, not installed on openbsd
-need to include sys/param.h and unistd.h to properly reach swapctl() prototype
-https://github.com/collectd/collectd/pull/779
---- configure.orig     Thu Feb 26 15:07:49 2015
-+++ configure  Sat May  2 20:22:14 2015
-@@ -12873,7 +12873,7 @@ eval "LTDLOPEN=\"$libname_spec\""
- 
- 
- 
--$as_echo "#define LIBTOOL_VERSION 2" >>confdefs.h
-+$as_echo "#define LIBTOOL_VERSION 1" >>confdefs.h
- 
- 
- 
-@@ -16954,7 +16954,7 @@ SAVE_CFLAGS="$CFLAGS"
+--- configure.orig     Wed May 27 10:51:50 2015
++++ configure  Wed Jun  3 15:45:37 2015
+@@ -17312,7 +17312,7 @@ SAVE_CFLAGS="$CFLAGS"
  # Emulate behavior of src/Makefile.am
  if test "x$GCC" = "xyes"
  then
@@ -23,69 +12,7 @@ https://github.com/collectd/collectd/pul
  fi
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strtok_r" >&5
-@@ -17666,8 +17666,11 @@ else
- #  undef _LARGEFILE64_SOURCE
- #endif
- #include <sys/stat.h>
-+#include <sys/param.h>
- #include <sys/swap.h>
-+#include <unistd.h>
- 
-+
- int
- main ()
- {
-@@ -17703,7 +17706,9 @@ else
- #  undef _LARGEFILE64_SOURCE
- #endif
- #include <sys/stat.h>
-+#include <sys/param.h>
- #include <sys/swap.h>
-+#include <unistd.h>
- 
- int
- main ()
-@@ -18740,16 +18745,16 @@ else
- fi
- 
- 
--ac_fn_c_check_member "$LINENO" "struct kinfo_proc" "kp_proc" 
"ac_cv_member_struct_kinfo_proc_kp_proc" "
-+ac_fn_c_check_member "$LINENO" "struct kinfo_proc" "p_pid" 
"ac_cv_member_struct_kinfo_proc_p_pid" "
- #include <sys/param.h>
- #include <sys/sysctl.h>
- #include <kvm.h>
- 
- "
--if test "x$ac_cv_member_struct_kinfo_proc_kp_proc" = xyes; then :
-+if test "x$ac_cv_member_struct_kinfo_proc_p_pid" = xyes; then :
- 
- cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_KINFO_PROC_KP_PROC 1
-+#define HAVE_STRUCT_KINFO_PROC_P_PID 1
- _ACEOF
- 
- 
-@@ -18763,16 +18768,16 @@ else
-               have_struct_kinfo_proc_openbsd="no"
- 
- fi
--ac_fn_c_check_member "$LINENO" "struct kinfo_proc" "kp_eproc" 
"ac_cv_member_struct_kinfo_proc_kp_eproc" "
-+ac_fn_c_check_member "$LINENO" "struct kinfo_proc" "p_ppid" 
"ac_cv_member_struct_kinfo_proc_p_ppid" "
- #include <sys/param.h>
- #include <sys/sysctl.h>
- #include <kvm.h>
- 
- "
--if test "x$ac_cv_member_struct_kinfo_proc_kp_eproc" = xyes; then :
-+if test "x$ac_cv_member_struct_kinfo_proc_p_ppid" = xyes; then :
- 
- cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_KINFO_PROC_KP_EPROC 1
-+#define HAVE_STRUCT_KINFO_PROC_P_PPID 1
- _ACEOF
- 
- 
-@@ -22990,23 +22995,7 @@ fi
+@@ -23486,23 +23486,7 @@ fi
  done
  
  fi
@@ -109,21 +36,3 @@ https://github.com/collectd/collectd/pul
  if test "x$with_libpcap" = "xyes"
  then
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libpcap has 
PCAP_ERROR_IFACE_NOT_UP" >&5
-@@ -23235,7 +23224,7 @@ then
-       SAVE_LIBS="$LIBS"
-       # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
-       # (see issues #41 and #42)
--      CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
-+      CFLAGS="$CFLAGS $PERL_CFLAGS -Wall"
-       LIBS="$LIBS $PERL_LIBS"
- 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken 
Perl_load_module()" >&5
-@@ -26803,7 +26792,7 @@ then
-       plugin_processes="yes"
- fi
- 
--if test "x$with_kvm_getprocs" = "xyes" && test 
"x$have_struct_kinfo_proc_freebsd" = "xyes"
-+if test "x$with_kvm_getprocs" = "xyes" && test 
"x$have_struct_kinfo_proc_openbsd" = "xyes"
- then
-       plugin_processes="yes"
- fi
Index: patches/patch-src_Makefile_in
===================================================================
RCS file: /cvs/ports/sysutils/collectd/patches/patch-src_Makefile_in,v
retrieving revision 1.7
diff -u -p -r1.7 patch-src_Makefile_in
--- patches/patch-src_Makefile_in       3 May 2015 10:41:35 -0000       1.7
+++ patches/patch-src_Makefile_in       5 Jun 2015 13:52:56 -0000
@@ -1,40 +1,30 @@
-$OpenBSD: patch-src_Makefile_in,v 1.7 2015/05/03 10:41:35 landry Exp $
-Install config file in examples/
---- src/Makefile.in.orig       Thu Feb 26 15:07:47 2015
-+++ src/Makefile.in    Sat May  2 20:11:03 2015
+$OpenBSD$
+--- src/Makefile.in.orig       Wed Jun  3 00:09:27 2015
++++ src/Makefile.in    Wed Jun  3 00:13:09 2015
 @@ -80,7 +80,7 @@ POST_UNINSTALL = :
  build_triplet = @build@
  host_triplet = @host@
  @BUILD_WITH_OWN_LIBOCONFIG_TRUE@am__append_1 = liboconfig
 -@BUILD_FEATURE_DAEMON_TRUE@am__append_2 = 
-DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
 +@BUILD_FEATURE_DAEMON_TRUE@am__append_2 = 
-DPIDFILE='"${localstatedir}/${PACKAGE_NAME}/${PACKAGE_NAME}.pid"'
- sbin_PROGRAMS = collectd$(EXEEXT) collectdmon$(EXEEXT)
+ sbin_PROGRAMS = collectdmon$(EXEEXT)
  bin_PROGRAMS = collectd-nagios$(EXEEXT) collectdctl$(EXEEXT) \
-       collectd-tg$(EXEEXT) $(am__EXEEXT_1)
-@@ -2316,11 +2316,11 @@ top_build_prefix = @top_build_prefix@
- top_builddir = @top_builddir@
+       collectd-tg$(EXEEXT)
+@@ -2430,11 +2430,11 @@ top_builddir = @top_builddir@
  top_srcdir = @top_srcdir@
- SUBDIRS = libcollectdclient $(am__append_1)
+ SUBDIRS = libcollectdclient $(am__append_1) daemon
+ PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex 
'\<module_register\>'
 -@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
 +@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
- AM_CPPFLAGS = -DPREFIX='"${prefix}"' \
+ AM_CPPFLAGS = -I$(srcdir)/daemon -DPREFIX='"${prefix}"' \
        -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
        -DLOCALSTATEDIR='"${localstatedir}"' \
 -      -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' \
 +      -DPKGLOCALSTATEDIR='"${localstatedir}/${PACKAGE_NAME}"' \
        $(am__append_2) -DPLUGINDIR='"${pkglibdir}"' \
        -DPKGDATADIR='"${pkgdatadir}"'
- collectd_SOURCES = collectd.c collectd.h \
-@@ -2736,7 +2736,7 @@ CLEANFILES = $(am__append_449)
- @BUILD_PLUGIN_NOTIFY_DESKTOP_TRUE@notify_desktop_la_LIBADD = $(LIBNOTIFY_LIBS)
- @BUILD_PLUGIN_NOTIFY_EMAIL_TRUE@notify_email_la_SOURCES = notify_email.c
- @BUILD_PLUGIN_NOTIFY_EMAIL_TRUE@notify_email_la_LDFLAGS = -module 
-avoid-version
--@BUILD_PLUGIN_NOTIFY_EMAIL_TRUE@notify_email_la_LIBADD = -lesmtp -lssl 
-lcrypto -lpthread -ldl
-+@BUILD_PLUGIN_NOTIFY_EMAIL_TRUE@notify_email_la_LIBADD = -lesmtp -lssl 
-lcrypto -lpthread
- @BUILD_PLUGIN_NTPD_TRUE@ntpd_la_SOURCES = ntpd.c
- @BUILD_PLUGIN_NTPD_TRUE@ntpd_la_LDFLAGS = -module -avoid-version
- @BUILD_PLUGIN_NTPD_TRUE@ntpd_la_LIBADD = $(am__append_254)
-@@ -5039,13 +5039,8 @@ uninstall-man: uninstall-man1 uninstall-man5
+ AUTOMAKE_OPTIONS = subdir-objects
+@@ -5190,13 +5190,8 @@ uninstall-man: uninstall-man1 uninstall-man5
  @HAVE_PROTOC_C_TRUE@  protoc-c -I$(srcdir) --c_out . $(srcdir)/riemann.proto
  
  install-exec-hook:
Index: patches/patch-src_collectd_c
===================================================================
RCS file: patches/patch-src_collectd_c
diff -N patches/patch-src_collectd_c
--- patches/patch-src_collectd_c        17 Nov 2014 15:23:12 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_collectd_c,v 1.2 2014/11/17 15:23:12 landry Exp $
-https://github.com/collectd/collectd/issues/445
-https://github.com/collectd/collectd/pull/806
-http://svnweb.freebsd.org/ports?view=revision&revision=353903
-http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/sysutils/collectd/patches/patch-src_collectd.c?rev=1.1&content-type=text/x-cvsweb-markup
---- src/collectd.c.orig        Mon Sep 22 22:40:21 2014
-+++ src/collectd.c     Mon Sep 22 22:40:28 2014
-@@ -288,7 +288,7 @@ static int do_init (void)
- #endif
- 
- #if HAVE_LIBSTATGRAB
--      if (sg_init ())
-+      if (sg_init (0))
-       {
-               ERROR ("sg_init: %s", sg_str_error (sg_get_error ()));
-               return (-1);
Index: patches/patch-src_daemon_Makefile_in
===================================================================
RCS file: patches/patch-src_daemon_Makefile_in
diff -N patches/patch-src_daemon_Makefile_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_daemon_Makefile_in        5 Jun 2015 13:52:56 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- src/daemon/Makefile.in.orig        Wed Jun  3 21:17:45 2015
++++ src/daemon/Makefile.in     Wed Jun  3 21:17:20 2015
+@@ -79,7 +79,7 @@ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-@BUILD_FEATURE_DAEMON_TRUE@am__append_1 = 
-DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
++@BUILD_FEATURE_DAEMON_TRUE@am__append_1 = 
-DPIDFILE='"${localstatedir}/${PACKAGE_NAME}/${PACKAGE_NAME}.pid"'
+ sbin_PROGRAMS = collectd$(EXEEXT)
+ 
+ # Link to these libraries..
+@@ -710,7 +710,7 @@ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = -I$(top_srcdir)/src -DPREFIX='"${prefix}"' \
+       -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
+       -DLOCALSTATEDIR='"${localstatedir}"' \
+-      -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' \
++      -DPKGLOCALSTATEDIR='"${localstatedir}/${PACKAGE_NAME}"' \
+       $(am__append_1) -DPLUGINDIR='"${pkglibdir}"' \
+       -DPKGDATADIR='"${pkgdatadir}"'
+ AUTOMAKE_OPTIONS = subdir-objects
Index: patches/patch-src_memory_c
===================================================================
RCS file: patches/patch-src_memory_c
diff -N patches/patch-src_memory_c
--- patches/patch-src_memory_c  17 Nov 2014 15:23:12 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-src_memory_c,v 1.2 2014/11/17 15:23:12 landry Exp $
-https://github.com/collectd/collectd/pull/808
---- src/memory.c.orig  Thu Jul 10 07:50:50 2014
-+++ src/memory.c       Thu Jul 10 07:52:54 2014
-@@ -30,6 +30,7 @@
- #ifdef HAVE_SYS_SYSCTL_H
- # include <sys/sysctl.h>
- #endif
-+#include <sys/vmmeter.h>
- 
- #ifdef HAVE_MACH_KERN_RETURN_H
- # include <mach/kern_return.h>
Index: patches/patch-src_plugin_h
===================================================================
RCS file: patches/patch-src_plugin_h
diff -N patches/patch-src_plugin_h
--- patches/patch-src_plugin_h  27 Oct 2014 09:07:07 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-$OpenBSD: patch-src_plugin_h,v 1.2 2014/10/27 09:07:07 landry Exp $
-https://github.com/collectd/collectd/pull/779
-missing include for pthread_t type
---- src/plugin.h.orig  Mon Sep 22 17:24:30 2014
-+++ src/plugin.h       Mon Sep 22 17:26:33 2014
-@@ -22,6 +22,7 @@
-  *   Sebastian Harl <sh at tokkee.org>
-  **/
- 
-+#include <pthread.h>
- #include "collectd.h"
- #include "configfile.h"
- #include "meta_data.h"
Index: patches/patch-src_processes_c
===================================================================
RCS file: patches/patch-src_processes_c
diff -N patches/patch-src_processes_c
--- patches/patch-src_processes_c       27 Oct 2014 09:07:07 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,191 +0,0 @@
-$OpenBSD: patch-src_processes_c,v 1.2 2014/10/27 09:07:07 landry Exp $
-https://github.com/collectd/collectd/pull/778
---- src/processes.c.orig       Sun Jan 26 09:09:14 2014
-+++ src/processes.c    Sun Oct 26 21:27:10 2014
-@@ -94,13 +94,13 @@
- #  endif
- /* #endif KERNEL_LINUX */
- 
--#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
-+#elif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD )
- #  include <kvm.h>
- #  include <sys/param.h>
- #  include <sys/sysctl.h>
- #  include <sys/user.h>
- #  include <sys/proc.h>
--/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
-+/* #endif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD ) */
- 
- #elif HAVE_PROCINFO_H
- #  include <procinfo.h>
-@@ -210,9 +210,9 @@ static mach_msg_type_number_t     pset_list_len;
- static long pagesize_g;
- /* #endif KERNEL_LINUX */
- 
--#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
-+#elif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD )
- static int pagesize;
--/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
-+/* #endif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD ) */
- 
- #elif HAVE_PROCINFO_H
- static  struct procentry64 procentry[MAXPROCENTRY];
-@@ -619,9 +619,9 @@ static int ps_init (void)
-                       pagesize_g, CONFIG_HZ);
- /* #endif KERNEL_LINUX */
- 
--#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
-+#elif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD )
-       pagesize = getpagesize();
--/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
-+/* #endif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD ) */
- 
- #elif HAVE_PROCINFO_H
-       pagesize = getpagesize();
-@@ -1777,14 +1777,14 @@ static int ps_read (void)
-       read_fork_rate();
- /* #endif KERNEL_LINUX */
- 
--#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
-+#elif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD )
-       int running  = 0;
-       int sleeping = 0;
-       int zombies  = 0;
-       int stopped  = 0;
--      int blocked  = 0;
-+      int onproc   = 0;
-       int idle     = 0;
--      int wait     = 0;
-+      int dead     = 0;
- 
-       kvm_t *kd;
-       char errbuf[1024];
-@@ -1808,7 +1808,7 @@ static int ps_read (void)
-       }
- 
-       /* Get the list of processes. */
--      procs = kvm_getprocs(kd, KERN_PROC_ALL, 0, &count);
-+      procs = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), 
&count);
-       if (procs == NULL)
-       {
-               ERROR ("processes plugin: Cannot get kvm processes list: %s",
-@@ -1822,22 +1822,20 @@ static int ps_read (void)
-       {
-               /* Create only one process list entry per _process_, i.e.
-                * filter out threads (duplicate PID entries). */
--              if ((proc_ptr == NULL) || (proc_ptr->ki_pid != procs[i].ki_pid))
-+              if ((proc_ptr == NULL) || (proc_ptr->p_pid != procs[i].p_pid))
-               {
-                       char cmdline[ARG_MAX] = "";
-                       _Bool have_cmdline = 0;
- 
-                       proc_ptr = &(procs[i]);
--                      /* Don't probe system processes and processes without 
arguments */
--                      if (((procs[i].ki_flag & P_SYSTEM) == 0)
--                                      && (procs[i].ki_args != NULL))
-+                      /* Don't probe zombie processes */
-+                      if (!P_ZOMBIE(proc_ptr))
-                       {
-                               char **argv;
-                               int argc;
-                               int status;
- 
--                              /* retrieve the arguments */
--                              argv = kvm_getargv (kd, proc_ptr, /* nchr = */ 
0);
-+                              argv = kvm_getargv (kd, proc_ptr, 0);
-                               argc = 0;
-                               if ((argv != NULL) && (argv[0] != NULL))
-                               {
-@@ -1852,39 +1850,28 @@ static int ps_read (void)
-                               }
-                       } /* if (process has argument list) */
- 
--                      pse.id       = procs[i].ki_pid;
-+                      pse.id       = procs[i].p_pid;
-                       pse.age      = 0;
- 
-                       pse.num_proc = 1;
--                      pse.num_lwp  = procs[i].ki_numthreads;
-+                      pse.num_lwp  = 1; /*procs[i].ki_numthreads; see top -H 
code*/
- 
--                      pse.vmem_size = procs[i].ki_size;
--                      pse.vmem_rss = procs[i].ki_rssize * pagesize;
--                      pse.vmem_data = procs[i].ki_dsize * pagesize;
--                      pse.vmem_code = procs[i].ki_tsize * pagesize;
--                      pse.stack_size = procs[i].ki_ssize * pagesize;
-+                      pse.vmem_rss = procs[i].p_vm_rssize * pagesize;
-+                      pse.vmem_data = procs[i].p_vm_dsize * pagesize;
-+                      pse.vmem_code = procs[i].p_vm_tsize * pagesize;
-+                      pse.stack_size = procs[i].p_vm_ssize * pagesize;
-+                      pse.vmem_size = pse.stack_size + pse.vmem_code + 
pse.vmem_data;
-                       pse.vmem_minflt = 0;
--                      pse.vmem_minflt_counter = procs[i].ki_rusage.ru_minflt;
-+                      pse.vmem_minflt_counter = procs[i].p_uru_minflt;
-                       pse.vmem_majflt = 0;
--                      pse.vmem_majflt_counter = procs[i].ki_rusage.ru_majflt;
-+                      pse.vmem_majflt_counter = procs[i].p_uru_majflt;
- 
-                       pse.cpu_user = 0;
-                       pse.cpu_system = 0;
--                      pse.cpu_user_counter = 0;
--                      pse.cpu_system_counter = 0;
--                      /*
--                       * The u-area might be swapped out, and we can't get
--                       * at it because we have a crashdump and no swap.
--                       * If it's here fill in these fields, otherwise, just
--                       * leave them 0.
--                       */
--                      if (procs[i].ki_flag & P_INMEM)
--                      {
--                              pse.cpu_user_counter = 
procs[i].ki_rusage.ru_utime.tv_usec
--                                      + (1000000lu * 
procs[i].ki_rusage.ru_utime.tv_sec);
--                              pse.cpu_system_counter = 
procs[i].ki_rusage.ru_stime.tv_usec
--                                      + (1000000lu * 
procs[i].ki_rusage.ru_stime.tv_sec);
--                      }
-+                      pse.cpu_user_counter = procs[i].p_uutime_usec +
-+                                              (1000000lu * 
procs[i].p_uutime_sec);
-+                      pse.cpu_system_counter = procs[i].p_ustime_usec +
-+                                              (1000000lu * 
procs[i].p_ustime_sec);
- 
-                       /* no I/O data */
-                       pse.io_rchar = -1;
-@@ -1892,17 +1879,17 @@ static int ps_read (void)
-                       pse.io_syscr = -1;
-                       pse.io_syscw = -1;
- 
--                      ps_list_add (procs[i].ki_comm, have_cmdline ? cmdline : 
NULL, &pse);
--              } /* if ((proc_ptr == NULL) || (proc_ptr->ki_pid != 
procs[i].ki_pid)) */
-+                      ps_list_add (procs[i].p_comm, have_cmdline ? cmdline : 
NULL, &pse);
-+              } /* if ((proc_ptr == NULL) || (proc_ptr->p_pid != 
procs[i].p_pid)) */
- 
--              switch (procs[i].ki_stat)
-+              switch (procs[i].p_stat)
-               {
-                       case SSTOP:     stopped++;      break;
-                       case SSLEEP:    sleeping++;     break;
-                       case SRUN:      running++;      break;
-                       case SIDL:      idle++;         break;
--                      case SWAIT:     wait++;         break;
--                      case SLOCK:     blocked++;      break;
-+                      case SONPROC:   onproc++;       break;
-+                      case SDEAD:     dead++;         break;
-                       case SZOMB:     zombies++;      break;
-               }
-       }
-@@ -1913,13 +1900,13 @@ static int ps_read (void)
-       ps_submit_state ("sleeping", sleeping);
-       ps_submit_state ("zombies",  zombies);
-       ps_submit_state ("stopped",  stopped);
--      ps_submit_state ("blocked",  blocked);
-+      ps_submit_state ("onproc",   onproc);
-       ps_submit_state ("idle",     idle);
--      ps_submit_state ("wait",     wait);
-+      ps_submit_state ("dead",     dead);
- 
-       for (ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next)
-               ps_submit_proc_list (ps_ptr);
--/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
-+/* #endif HAVE_LIBKVM_GETPROCS && ( HAVE_STRUCT_KINFO_PROC_FREEBSD || 
HAVE_STRUCT_KINFO_PROC_OPENBSD ) */
- 
- #elif HAVE_PROCINFO_H
-       /* AIX */
Index: patches/patch-src_tcpconns_c
===================================================================
RCS file: patches/patch-src_tcpconns_c
diff -N patches/patch-src_tcpconns_c
--- patches/patch-src_tcpconns_c        3 May 2015 10:41:35 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-$OpenBSD: patch-src_tcpconns_c,v 1.5 2015/05/03 10:41:35 landry Exp $
-https://github.com/collectd/collectd/pull/779
-https://github.com/collectd/collectd/pull/808
---- src/tcpconns.c.orig        Thu Feb 26 11:43:48 2015
-+++ src/tcpconns.c     Sat May  2 20:11:03 2015
-@@ -909,7 +909,6 @@ static int conn_init (void)
- static int conn_read (void)
- {
-   struct inpcbtable table;
--  struct inpcb *head;
-   struct inpcb *next;
-   struct inpcb inpcb;
-   struct tcpcb tcpcb;
-@@ -922,18 +921,16 @@ static int conn_read (void)
-   if (status != 0)
-     return (-1);
- 
--  /* Get the `head' pcb */
--  head = (struct inpcb *) &(inpcbtable_ptr->inpt_queue);
-   /* Get the first pcb */
--  next = (struct inpcb *)CIRCLEQ_FIRST (&table.inpt_queue);
-+  next = (struct inpcb *)TAILQ_FIRST (&table.inpt_queue);
- 
--  while (next != head)
-+  while (next)
-   {
-     /* Read the pcb pointed to by `next' into `inpcb' */
-     kread ((u_long) next, &inpcb, sizeof (inpcb));
- 
-     /* Advance `next' */
--    next = (struct inpcb *)CIRCLEQ_NEXT (&inpcb, inp_queue);
-+    next = (struct inpcb *)TAILQ_NEXT (&inpcb, inp_queue);
- 
-     /* Ignore sockets, that are not connected. */
- #ifdef __NetBSD__
-@@ -950,7 +947,7 @@ static int conn_read (void)
- 
-     kread ((u_long) inpcb.inp_ppcb, &tcpcb, sizeof (tcpcb));
-     conn_handle_ports (ntohs(inpcb.inp_lport), ntohs(inpcb.inp_fport), 
tcpcb.t_state);
--  } /* while (next != head) */
-+  } /* while (next) */
- 
-   conn_submit_all ();
- 
Index: patches/patch-src_users_c
===================================================================
RCS file: patches/patch-src_users_c
diff -N patches/patch-src_users_c
--- patches/patch-src_users_c   17 Nov 2014 15:23:12 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-$OpenBSD: patch-src_users_c,v 1.2 2014/11/17 15:23:12 landry Exp $
-Fix build with libstatgrab >= 0.90
-From http://svnweb.freebsd.org/ports?view=revision&revision=360770
-https://github.com/collectd/collectd/pull/806
---- src/users.c.orig   Mon Sep 22 22:36:50 2014
-+++ src/users.c        Mon Sep 22 22:37:17 2014
-@@ -101,12 +101,13 @@ static int users_read (void)
- 
- #elif HAVE_LIBSTATGRAB
-       sg_user_stats *us;
-+      size_t num_entries;
- 
--      us = sg_get_user_stats ();
-+      us = sg_get_user_stats (&num_entries);
-       if (us == NULL)
-               return (-1);   
- 
--      users_submit ((gauge_t) us->num_entries);
-+      users_submit ((gauge_t) num_entries);
- /* #endif HAVE_LIBSTATGRAB */
- 
- #else
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/sysutils/collectd/pkg/PLIST-main,v
retrieving revision 1.8
diff -u -p -r1.8 PLIST-main
--- pkg/PLIST-main      1 Dec 2014 09:07:12 -0000       1.8
+++ pkg/PLIST-main      5 Jun 2015 13:52:56 -0000
@@ -1,4 +1,4 @@
-@comment $OpenBSD: PLIST-main,v 1.8 2014/12/01 09:07:12 landry Exp $
+@comment $OpenBSD$
 @newgroup _collectd:652
 @newuser _collectd:652:652:daemon:Collectd Daemon:/var/empty:/sbin/nologin
 @bin bin/collectd-nagios
@@ -10,6 +10,8 @@ include/collectd/lcc_features.h
 include/collectd/network.h
 include/collectd/network_buffer.h
 lib/collectd/
+@comment lib/collectd/aggregation.la
+lib/collectd/aggregation.so
 @comment lib/collectd/apache.la
 lib/collectd/apache.so
 @comment lib/collectd/apcups.la
@@ -24,6 +26,8 @@ lib/collectd/cpu.so
 lib/collectd/csv.so
 @comment lib/collectd/curl.la
 lib/collectd/curl.so
+@comment lib/collectd/curl_json.la
+lib/collectd/curl_json.so
 @comment lib/collectd/curl_xml.la
 lib/collectd/curl_xml.so
 @comment lib/collectd/df.la
@@ -36,12 +40,16 @@ lib/collectd/dns.so
 lib/collectd/email.so
 @comment lib/collectd/exec.la
 lib/collectd/exec.so
+@comment lib/collectd/fhcount.la
+lib/collectd/fhcount.so
 @comment lib/collectd/filecount.la
 lib/collectd/filecount.so
 @comment lib/collectd/interface.la
 lib/collectd/interface.so
 @comment lib/collectd/load.la
 lib/collectd/load.so
+@comment lib/collectd/log_logstash.la
+lib/collectd/log_logstash.so
 @comment lib/collectd/logfile.la
 lib/collectd/logfile.so
 @comment lib/collectd/match_empty_counter.la
@@ -102,6 +110,8 @@ lib/collectd/tcpconns.so
 lib/collectd/teamspeak2.so
 @comment lib/collectd/ted.la
 lib/collectd/ted.so
+@comment lib/collectd/threshold.la
+lib/collectd/threshold.so
 @comment lib/collectd/unixsock.la
 lib/collectd/unixsock.so
 @comment lib/collectd/uptime.la
@@ -114,12 +124,16 @@ lib/collectd/uuid.so
 lib/collectd/write_graphite.so
 @comment lib/collectd/write_http.la
 lib/collectd/write_http.so
+@comment lib/collectd/write_log.la
+lib/collectd/write_log.so
+@comment lib/collectd/write_riemann.la
+lib/collectd/write_riemann.so
 @comment lib/libcollectdclient.la
 @lib lib/libcollectdclient.so.${LIBcollectdclient_VERSION}
 lib/pkgconfig/libcollectdclient.pc
 @comment libdata/perl5/${MACHINE_ARCH}-openbsd/
-@comment libdata/perl5/${MACHINE_ARCH}-openbsd/5.20.1/
-@comment libdata/perl5/${MACHINE_ARCH}-openbsd/5.20.1/perllocal.pod
+@comment libdata/perl5/${MACHINE_ARCH}-openbsd/5.20.2/
+@comment libdata/perl5/${MACHINE_ARCH}-openbsd/5.20.2/perllocal.pod
 libdata/perl5/site_perl/Collectd/
 libdata/perl5/site_perl/Collectd.pm
 libdata/perl5/site_perl/Collectd/Plugins/
@@ -145,13 +159,14 @@ libdata/perl5/site_perl/Collectd/Unixsoc
 share/collectd/
 share/collectd/postgresql_default.conf
 share/collectd/types.db
+share/doc/pkg-readmes/${FULLPKGNAME}
 share/examples/collectd.conf
+@group _collectd
 @mode 640
 @sample ${SYSCONFDIR}/collectd.conf
 @mode
 @owner _collectd
-@group _collectd
 @sample /var/collectd/
-@owner
 @group
+@owner
 @rcscript ${RCDIR}/collectd
Index: pkg/PLIST-virt
===================================================================
RCS file: /cvs/ports/sysutils/collectd/pkg/PLIST-virt,v
retrieving revision 1.1
diff -u -p -r1.1 PLIST-virt
--- pkg/PLIST-virt      3 May 2015 10:41:35 -0000       1.1
+++ pkg/PLIST-virt      5 Jun 2015 13:52:56 -0000
@@ -1,3 +1,3 @@
 @comment $OpenBSD: PLIST-virt,v 1.1 2015/05/03 10:41:35 landry Exp $
-@comment lib/collectd/libvirt.la
-lib/collectd/libvirt.so
+@comment lib/collectd/virt.la
+lib/collectd/virt.so
Index: pkg/README-main
===================================================================
RCS file: pkg/README-main
diff -N pkg/README-main
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/README-main     5 Jun 2015 13:52:56 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
++-----------------------------------------------------------------------
+| Running ${FULLPKGNAME} on OpenBSD
++-----------------------------------------------------------------------
+
+By default, collectd runs as root. Root privileges are required for some
+collectd plugins, namely dns and ping plugins.
+For more information, please referer to:
+${HOMEPAGE}wiki/index.php/Category:Plugins_requiring_privileges
+
+If you do not use these plugins, it is recommended to run collectd daemon
+with unpriviliged user account, _collectd. Adjust your configuration with
+the following command:
+
+       # rcctl set collectd user "_collectd"
Index: pkg/collectd.rc
===================================================================
RCS file: /cvs/ports/sysutils/collectd/pkg/collectd.rc,v
retrieving revision 1.1
diff -u -p -r1.1 collectd.rc
--- pkg/collectd.rc     25 Sep 2014 20:10:13 -0000      1.1
+++ pkg/collectd.rc     5 Jun 2015 13:52:56 -0000
@@ -4,6 +4,12 @@
 
 daemon="${TRUEPREFIX}/sbin/collectd"
 
+# Ensure _collectd can read ${SYSCONFDIR}/collectd.conf
+rc_pre() {
+    chgrp _collectd /etc/collectd.conf
+    chmod g+r /etc/collectd.conf
+}
+
 . /etc/rc.d/rc.subr
 
 rc_reload=NO

Reply via email to