pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
collectd: Implement NFS plugin for NetBSD
Module Name: pkgsrc-wip
Committed By: Edgar Fuß <ef%math.uni-bonn.de@localhost>
Pushed By: ef
Date: Fri Jul 17 18:46:42 2020 +0200
Changeset: c2042affe9dbc389382c1095e8ff060ae8f095a7
Modified Files:
collectd/distinfo
collectd/options.mk
collectd/patches/patch-configure.ac
Added Files:
collectd/patches/patch-src_nfs.c
Log Message:
collectd: Implement NFS plugin for NetBSD
Add (via patch-src_nfs.c) an implementation for the NFS plugin for NetBSD. In fact, that's the simplest implementation accross all OSes. Add corresponding option to options.mk and bits to configure.ac (via patch-configure.ac).
See https://github.com/collectd/collectd/pull/3333
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c2042affe9dbc389382c1095e8ff060ae8f095a7
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
collectd/distinfo | 3 +-
collectd/options.mk | 2 +
collectd/patches/patch-configure.ac | 10 +++--
collectd/patches/patch-src_nfs.c | 75 +++++++++++++++++++++++++++++++++++++
4 files changed, 85 insertions(+), 5 deletions(-)
diffs:
diff --git a/collectd/distinfo b/collectd/distinfo
index 2376ff1887..c816a0b90f 100644
--- a/collectd/distinfo
+++ b/collectd/distinfo
@@ -5,7 +5,7 @@ RMD160 (collectd-5.8.0.tar.bz2) = 7b812b1046d57a9047213bb182b8744d98606547
SHA512 (collectd-5.8.0.tar.bz2) = 1b3d0cc44e2ca54e13eebf292074f1efa8b33d6800d04405e0eaaa2dd1cb2416c6eae580729fb5aead23a5039f41ffe8a9989a907a8c18be8f867f1099fc0008
Size (collectd-5.8.0.tar.bz2) = 1686017 bytes
SHA1 (patch-Makefile.am) = 110cce600c66226bb02291349e76433555418edd
-SHA1 (patch-configure.ac) = 26ae76a97758da1f5e1b2cda600482c15ff4b7a1
+SHA1 (patch-configure.ac) = 91e2d0d6b0f9b592c52dfd2d0a02850416f04e93
SHA1 (patch-src_bind.c) = 4aa7742c8e24ee6bd7293abc56fc95a605d0a2c7
SHA1 (patch-src_collectd.conf.in) = f0b35085cf0ddfd766e140b145177ab1f1326f5f
SHA1 (patch-src_cpu.c) = e645ae6b05c051c3c878f88a493fbbd7d548bb66
@@ -19,6 +19,7 @@ SHA1 (patch-src_libcollectclient_network__buffer.c) = a19e1658017279c35fd9860e2a
SHA1 (patch-src_lua.c) = 656934889976f489abb80a8244492f845a3bd9f8
SHA1 (patch-src_memory.c) = 3276b09d0c09e0a9446519bd6c304d95c30b617a
SHA1 (patch-src_netstat__udp.c) = 30cb12d25f56c60959658dbd181783212e00cc61
+SHA1 (patch-src_nfs.c) = 6a174b852a38c5a87dda932255dfe8ed95668fb4
SHA1 (patch-src_processes.c) = a22b1e9d7935c7924b65c57990b4212990acc6b7
SHA1 (patch-src_read_kafka.c) = 05334bd0ea51ab386afce0cb3336378fcc42d997
SHA1 (patch-src_statsd.c) = 35f4349d2d2c9bddc0f4770344f969157cd012f6
diff --git a/collectd/options.mk b/collectd/options.mk
index 2782c398f2..57919a8c02 100644
--- a/collectd/options.mk
+++ b/collectd/options.mk
@@ -8,6 +8,8 @@ PKG_SUPPORTED_OPTIONS.NetBSD+= contextswitch disk entropy irq pf netstat_udp
PKG_SUPPORTED_OPTIONS.NetBSD+= swap tcpconns users processes
PKG_SUGGESTED_OPTIONS.NetBSD+= contextswitch disk entropy irq pf netstat_udp
PKG_SUGGESTED_OPTIONS.NetBSD+= swap tcpconns users processes
+PKG_SUPPORTED_OPTIONS.NetBSD+= nfs
+PKG_SUGGESTED_OPTIONS.NetBSD+= nfs
PKG_SUPPORTED_OPTIONS.FreeBSD+= contextswitch pf processes swap tcpconns zfs-arc
PKG_SUGGESTED_OPTIONS.FreeBSD+= contextswitch pf processes swap tcpconns zfs-arc
diff --git a/collectd/patches/patch-configure.ac b/collectd/patches/patch-configure.ac
index a4cdfb224d..3c6484039c 100644
--- a/collectd/patches/patch-configure.ac
+++ b/collectd/patches/patch-configure.ac
@@ -1,6 +1,6 @@
$NetBSD: patch-configure.ac,v 1.12 2020/03/19 06:26:26 rillig Exp $
-Add KERNEL_NETBSD, add entry and disk plugin for NetBSD,
+Add KERNEL_NETBSD, add entry and disk, nfs plugins for NetBSD,
and also do swap for "have_swapctl_three_args" (as for NetBSD).
Also, the start of process support, but that's not yet finished.
Correct tokyotyrant detection (add lib, not include, for -L).
@@ -42,15 +42,17 @@ Correct libupsclient detection (argument may be a searchable directory).
plugin_nfs="no"
plugin_numa="no"
plugin_ovs_events="no"
-@@ -6229,6 +6231,7 @@
+@@ -6228,7 +6230,9 @@
+ plugin_disk="yes"
plugin_entropy="yes"
plugin_irq="yes"
++ plugin_nfs="yes"
plugin_processes="yes"
+ plugin_netstat_udp="yes"
fi
# Mac OS X devices
-@@ -6568,6 +6571,7 @@
+@@ -6568,6 +6572,7 @@
AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics])
@@ -58,7 +60,7 @@ Correct libupsclient detection (argument may be a searchable directory).
AC_PLUGIN([network], [yes], [Network communication plugin])
AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
-@@ -6987,6 +6991,7 @@
+@@ -6987,6 +6992,7 @@
AC_MSG_RESULT([ mysql . . . . . . . . $enable_mysql])
AC_MSG_RESULT([ netapp . . . . . . . $enable_netapp])
AC_MSG_RESULT([ netlink . . . . . . . $enable_netlink])
diff --git a/collectd/patches/patch-src_nfs.c b/collectd/patches/patch-src_nfs.c
new file mode 100644
index 0000000000..8b22b4bb31
--- /dev/null
+++ b/collectd/patches/patch-src_nfs.c
@@ -0,0 +1,75 @@
+$NetBSD: patch-src_nfs.c,v $
+
+Provide a port to NetBSD.
+
+--- src/nfs.c.orig 2017-11-18 10:03:27.000000000 +0100
++++ src/nfs.c 2019-10-31 15:48:19.000000000 +0100
+@@ -27,6 +27,15 @@
+ #include "common.h"
+ #include "plugin.h"
+
++#if KERNEL_NETBSD
++#include <sys/param.h>
++#include <sys/mount.h>
++#include <sys/sysctl.h>
++#include <nfs/rpcv2.h>
++#include <nfs/nfsproto.h>
++#include <nfs/nfs.h>
++#endif
++
+ #if HAVE_KSTAT_H
+ #include <kstat.h>
+ #endif
+@@ -82,12 +91,14 @@ Number Procedures Procedures
+ 21 commit
+ */
+
++#if KERNEL_LINUX | HAVE_KSTAT
+ static const char *nfs2_procedures_names[] = {
+ "null", "getattr", "setattr", "root", "lookup", "readlink",
+ "read", "wrcache", "write", "create", "remove", "rename",
+ "link", "symlink", "mkdir", "rmdir", "readdir", "fsstat"};
+ static size_t nfs2_procedures_names_num =
+ STATIC_ARRAY_SIZE(nfs2_procedures_names);
++#endif
+
+ static const char *nfs3_procedures_names[] = {
+ "null", "getattr", "setattr", "lookup", "access", "readlink",
+@@ -320,7 +331,7 @@ static int nfs_config(const char *key, c
+ return 0;
+ }
+
+-#if KERNEL_LINUX
++#if KERNEL_LINUX || KERNEL_NETBSD
+ static int nfs_init(void) { return 0; }
+ /* #endif KERNEL_LINUX */
+
+@@ -596,6 +607,28 @@ static int nfs_read(void) {
+ }
+ /* #endif KERNEL_LINUX */
+
++#elif KERNEL_NETBSD
++static int nfs_read(void) {
++ struct nfsstats ns;
++ size_t size = sizeof(ns);
++ int mib[] = { CTL_VFS, 2, NFS_NFSSTATS };
++ value_t values[nfs3_procedures_names_num];
++ int i;
++
++ /* NetBSD reports v2 statistics mapped to v3 and doen't yet support v4 */
++ if (!report_v3) return 0;
++ if (sysctl(mib, 3, &ns, &size, NULL, 0) != 0) return 1;
++
++ for (i = 0; i < nfs3_procedures_names_num; i++) values[i].counter = (derive_t)ns.rpccnt[i];
++ nfs_procedures_submit("v3client", nfs3_procedures_names, values, nfs3_procedures_names_num);
++
++ for (i = 0; i < nfs3_procedures_names_num; i++) values[i].counter = (derive_t)ns.srvrpccnt[i];
++ nfs_procedures_submit("v3server", nfs3_procedures_names, values, nfs3_procedures_names_num);
++
++ return 0;
++}
++/* #endif KERNEL_NETBSD */
++
+ #elif HAVE_LIBKSTAT
+ static int nfs_read(void) {
+ if (report_v2) {
Home |
Main Index |
Thread Index |
Old Index