]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Warn user on unimplemented NFS stat requests on NetBSD 3377/head
authorDagobert Michelsen <dam@opencsw.org>
Fri, 21 Feb 2020 15:18:55 +0000 (16:18 +0100)
committerDagobert Michelsen <dam@opencsw.org>
Fri, 21 Feb 2020 15:21:14 +0000 (16:21 +0100)
src/nfs.c

index cbb4d1df97e3361afaadc364bda46225e1d343a2..ba9bc068cf4f9ff0fe6d732334040ce62e031aa8 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
@@ -621,9 +621,24 @@ static int nfs_read(void) {
   int i;
 
   /* NetBSD reports v2 statistics mapped to v3 and doen't yet support v4 */
-  if (!report_v3)
+  if (report_v2) {
+    if (!suppress_warning) {
+      WARNING(
+          "nfs plugin: NFSv2 statistics have been requested "
+          "but they are mapped to NFSv3 statistics in the kernel on NetBSD.");
+    }
     return 0;
-  if (sysctl(mib, 3, &ns, &size, NULL, 0) != 0)
+  }
+
+  if (report_v4) {
+    if (!suppress_warning) {
+      WARNING("nfs plugin: NFSv4 statistics have been requested "
+              "but they are not yet supported on NetBSD.");
+    }
+    return 0;
+  }
+
+  if (sysctl(mib, STATIC_ARRAY_SIZE(mib), &ns, &size, NULL, 0) != 0)
     return 1;
 
   for (i = 0; i < nfs3_procedures_names_num; i++)