Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion collector/filesystem_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type filesystemCollector struct {
}

type filesystemLabels struct {
device, mountPoint, fsType string
device, mountPoint, fsType, options string
}

type filesystemStats struct {
Expand Down
8 changes: 6 additions & 2 deletions collector/filesystem_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,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{
Expand Down Expand Up @@ -97,6 +100,7 @@ func mountPointDetails() ([]filesystemLabels, error) {
device: parts[0],
mountPoint: parts[1],
fsType: parts[2],
options: parts[3],
})
}
return filesystems, scanner.Err()
Expand Down