diff --git a/collector/filesystem_common.go b/collector/filesystem_common.go index 47ee4bff..da4cecd3 100644 --- a/collector/filesystem_common.go +++ b/collector/filesystem_common.go @@ -51,7 +51,7 @@ type filesystemCollector struct { } type filesystemLabels struct { - device, mountPoint, fsType string + device, mountPoint, fsType, options string } type filesystemStats struct { diff --git a/collector/filesystem_linux.go b/collector/filesystem_linux.go index 78e0aea0..eedce006 100644 --- a/collector/filesystem_linux.go +++ b/collector/filesystem_linux.go @@ -91,8 +91,11 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) { } var ro float64 - if (buf.Flags & readOnly) != 0 { - ro = 1 + for _, option := range strings.Split(labels.options, ",") { + if option == "ro" { + ro = 1 + break + } } stats = append(stats, filesystemStats{ @@ -150,6 +153,7 @@ func mountPointDetails() ([]filesystemLabels, error) { device: parts[0], mountPoint: parts[1], fsType: parts[2], + options: parts[3], }) } return filesystems, scanner.Err()