Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZFS Collector does not handle spaces in dataset names #3170

Open
jdfalk opened this issue Nov 3, 2024 · 1 comment · May be fixed by #3186
Open

ZFS Collector does not handle spaces in dataset names #3170

jdfalk opened this issue Nov 3, 2024 · 1 comment · May be fixed by #3186

Comments

@jdfalk
Copy link

jdfalk commented Nov 3, 2024

Host operating system: output of uname -a

Linux nxserv1 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

node_exporter version: output of node_exporter --version

$ node_exporter --version
node_exporter, version 1.8.2 (branch: HEAD, revision: f1e0e8360aa60b6cb5e5cc1560bed348fc2c1895)
  build user:       root@03d440803209
  build date:       20240714-11:53:45
  go version:       go1.22.5
  platform:         linux/amd64
  tags:             unknown

node_exporter command line flags

docker command line args:

    command:
      - "--path.procfs=/host/proc"
      - "--path.sysfs=/host/sys"
      - "--path.udev.data=/host/run/udev/data"
      - "--path.rootfs=/host"
      - '--collector.filesystem.mount-points-exclude=(^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/.+)($$|/))|(^/host/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/.+)($$|/))|()'

System command line args:
It does it with or without the following args, I just added that in hopes it would solve the issue.

--collector.filesystem.mount-points-exclude=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/.+)($|/)

node_exporter log output

ts=2024-11-03T21:40:27.312Z caller=stdlib.go:105 level=error msg="error gathering metrics: 23 error(s) occurred:
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_writes\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:2.6997966e+07}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_nwritten\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:3.0888020805e+10}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_reads\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:1.1041624633e+10}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_nread\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:1.1319123401779e+13}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_nunlinks\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:132514}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_nunlinked\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:132509}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_commit_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:8584}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_commit_writer_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:8584}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:6.657743e+06}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_indirect_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:309}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_indirect_bytes\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:2.1049166e+07}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_copied_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:0}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_copied_bytes\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:0}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_needcopy_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:6.612229e+06}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_needcopy_bytes\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:5.911215008e+09}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_normal_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:61072}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_normal_bytes\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:7.193258424e+09}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_normal_write\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:7.998984192e+09}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_normal_alloc\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:7.998984192e+09}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_slog_count\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:0}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_slog_bytes\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:0}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_slog_write\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:0}} was collected before with the same name and label values
* [from Gatherer #2] collected metric \"node_zfs_zpool_dataset_zil_itx_metaslab_slog_alloc\" { label:{name:\"dataset\"  value:\"myzpool/myzpool/plexmediaserver/Library/Application\"}  label:{name:\"zpool\"  value:\"myzpool\"}  untyped:{value:0}} was collected before with the same name and label values"

Are you running node_exporter in Docker?

Happens in docker and on Host OS

What did you do that produced an error?

Just installed the node exporter and it started happening, if you mean what is causing the error? I suspect it's because my datasets have spaces in the names. The full name of that dataset is myzpool/myzpool/plexmediaserver/Library/Application Support

What did you expect to see?

Normal ZFS statistics

What did you see instead?

See log

@khafatech
Copy link

This seems like a bug, with a fairly straightforward fix. I'll submit a PR sometime today.

parsePoolObjsetFile is splitting the line using whitespace.

However, according to entity_namecheck() in the zfs code, a dataset can contain a space character:

 * Entity names must be of the following form:
 *
 *	[component/]*[component][(@|#)component]?
 *
 * Where each component is made up of alphanumeric characters plus the following
 * characters:
 *
 *	[-_.: %]

@khafatech khafatech linked a pull request Nov 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants