Skip to content

ZFS collector misparses dataset values that occur in the kstat field prefix #3761

Description

@by-carlos

Host operating system

Linux 7.0.14-4-pve x86_64, OpenZFS 2.4.3

node_exporter version

Reproduced with both:

  • node_exporter 1.9.1
  • node_exporter 1.12.1

The same parsing code is present on the current default branch.

What did you do?

Created/read the root dataset of a pool named data. Its objset kstat contains
a valid string field:

dataset_name                    7    data

The child dataset data/vm-1101-disk-0 is parsed correctly, so this is specific
to a dataset value that occurs earlier in the complete input line.

What did you expect to see?

node_zfs_zpool_dataset_nwritten{dataset="data",zpool="data"} ...

What did you see instead?

node_zfs_zpool_dataset_nwritten{dataset="dataset_name                    7    data",zpool="data"} ...

Cause

parsePoolObjsetFile currently extracts the dataset with:

datasetName = line[strings.Index(line, parts[2]):]

For the value data, strings.Index matches the data at the beginning of
dataset_name, rather than the value in the third column. The resulting label
is therefore the entire input line. Joining parts[2:] would retain dataset
names containing spaces without searching the field-name/type prefix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions