Skip to content

Metric "node_filesystem_readonly" does not include super options when calculating #3157

@duanchao2035

Description

@duanchao2035

Question description

Hello, I would like to ask a question. When using node-exporter for metric collection, I have noticed an inconsistency in the behavior of the metric "node_filesystem_readonly" across different versions. In version 1.6.1, the value is obtained through /proc/1/mounts' options, while in the latest version, it is obtained through /proc/1/mountinfo. When I execute the following commands on the host with a read-only root partition:

cat /proc/1/mountinfo | grep /dev/md127
44 0 9:127 / / rw,relatime shared:1 - ext4 /dev/md127 ro
cat /proc/1/mounts | grep md127
/dev/md127 / ext4 ro,relatime 0 0

As per the code logic, in version 1.6.1, the "ro" value is 1, whereas in the latest version, it is 0 (the options value in the new version's file does not include "ro", but the super options include it). I would like to confirm whether this metric's meaning does not include cases where super options are set to "ro".

The PR that caused this question: b9d0932

Host operating system: output of uname -a

Linux host 4.19.90-2307.3.0.el7.v60.x86_64 #1 SMP Mon Aug 26 14:27:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

node_exporter version: output of node_exporter --version

node_exporter, version 1.6.1 (branch: HEAD, revision: 4a1b776)
build user: root@586879db11e5
build date: 20230717-12:10:52
go version: go1.20.6
platform: linux/amd64
tags: netgo osusergo static_build

node_exporter command line flags

node_exporter log output

Are you running node_exporter in Docker?

no

What did you do that produced an error?

Make the root partition read-only

What did you expect to see?

The node_filesystem_readonly{mountpoint="/"} is set to 1 when the root partition is read-only.

What did you see instead?

The node_filesystem_readonly{mountpoint="/"} is set to 0 when the root partition is read-only.

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