zfs_arc plugin skips hits/misses in collectd5.9.2g on 20.04

Bug #1876135 reported by Durk van Veen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
collectd (Ubuntu)
New
Undecided
Unassigned

Bug Description

$ lsb_release -rd
Description: Ubuntu 20.04 LTS
Release: 20.04
$ dpkg --list | grep collectd
ii collectd-core 5.9.2.g-1ubuntu5 amd64 statistics collection and monitoring daemon (core system)

The zfs_arc plug-in for collectd is broken in 5.9.2g for the "hits" and "misses" lines of /proc/spl/kstat/zfs/arcstats. Due to a bug in zfs_arc.c, the first 2 lines of this file are skipped twice, resulting in 4 lines being skipped.

I was able to confirm that just by taking /usr/lib/collectd/zfs_arc.so from a working 18.04 installation and dropping it on the 20.04 box, the problem could be resolved.

Then I rebuilt the package from source with a single hunk of code removed from zfs_arc.c that was not present in 5.9.2, introduced in 5.9.2g, and removed again in upstream debian 5.10.0. This fixes the issue.

I also traced it to the collectd upstream and there the change was made as part of commit 0cc3044f with a commit message that specifically describes the problem.

--- collectd.5.9.2g/zfs_arc.c 2020-04-29 23:19:26.307645579 -0700
+++ collectd.5.10.0/zfs_arc.c 2020-04-29 23:20:19.658663146 -0700
@@ -231,23 +231,6 @@
     return -1;
   }

- // Ignore the first two lines because they contain information about
- // the rest of the file.
- // See kstat_seq_show_headers module/spl/spl-kstat.c of the spl kernel
- // module.
- if (fgets(buffer, sizeof(buffer), fh) == NULL) {
- ERROR("zfs_arc plugin: \"%s\" does not contain a single line.",
- ZOL_ARCSTATS_FILE);
- fclose(fh);
- return (-1);
- }
- if (fgets(buffer, sizeof(buffer), fh) == NULL) {
- ERROR("zfs_arc plugin: \"%s\" does not contain at least two lines.",
- ZOL_ARCSTATS_FILE);
- fclose(fh);
- return (-1);
- }
-
   while (fgets(buffer, sizeof(buffer), fh) != NULL) {
     char *fields[3];
     value_t v;

summary: - ARC Hit Ratio does not work in collectd zfs_arc
+ zfs_arc plugin skips hits/misses in collectd5.9.2g on 20.04
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.