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

Add Disk IO stats and ext4 FS stats #651

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mshahzeb
Copy link

@mshahzeb mshahzeb commented Jul 9, 2024

Related to: prometheus/node_exporter#3005

Node exporter PR: prometheus/node_exporter#3047

Adds function to return disk stats from:

  • /sys/block/<disk>/device/ioerr_cnt: number of SCSI commands that completed with an error
  • /sys/block/<disk>/device/iodone_cnt: number of completed or rejected SCSI commands

Add function to return stats for ext4 filesystem

  • /sys/fs/ext4/<partition>/errors_count: number of ext4 errors (commit)
  • /sys/fs/ext4/<partition>/warning_count: number of ext4 warning log messages (commit)
  • /sys/fs/ext4/<partition>/msg_count: number of other ext4 log messages

@mshahzeb mshahzeb closed this Jul 10, 2024
@mshahzeb mshahzeb reopened this Jul 10, 2024
@mshahzeb mshahzeb changed the title Add io fs stats Add Disk IO stats and ext4 FS stats Jul 11, 2024
Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SuperQ
Copy link
Member

SuperQ commented Jul 14, 2024

Looks like the tests still fail. Also DCO.

This needs a DCO sign-off. You can use git commit -s --amend to add it.

@mshahzeb
Copy link
Author

DCO sign off fixed.

@SuperQ
Copy link
Member

SuperQ commented Jul 15, 2024

Please go fmt your change. As well as git rebase -i origin/master to squash your commits.

@mshahzeb
Copy link
Author

Done and ran git rebase -i origin/master as well but did not seem to squash my commits

@mshahzeb mshahzeb force-pushed the add-io-fs-stats branch 4 times, most recently from 7fa9f21 to afabf5c Compare July 16, 2024 18:35
@mshahzeb
Copy link
Author

Commits squashed and rebased with master

@mshahzeb mshahzeb force-pushed the add-io-fs-stats branch 2 times, most recently from 371d88f to 31275d1 Compare July 17, 2024 18:30
if err != nil {
return 0, err
}
return strconv.ParseUint(strings.TrimSpace(string(data[2:])), 16, 64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should validate that the string starts with 0x before trying to parse the value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@mshahzeb mshahzeb force-pushed the add-io-fs-stats branch 3 times, most recently from 4d322a4 to 19c8632 Compare July 20, 2024 17:38
@mshahzeb mshahzeb requested a review from SuperQ July 20, 2024 17:40
}
hexString := strings.TrimSpace(string(data))
if !strings.HasPrefix(hexString, "0x") {
return 0, fmt.Errorf("invalid format: hex string does not start with '0x'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 0, fmt.Errorf("invalid format: hex string does not start with '0x'")
return 0, errors.New("invalid format: hex string does not start with '0x'")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Adds function to return disk stats from:
* /sys/block/<disk>/device/ioerr_cnt: number of SCSI commands that completed with an error
* /sys/block/<disk>/device/iodone_cnt: number of completed or rejected SCSI commands

Add function to return stats for ext4 filesystem
* /sys/fs/ext4/<partition>/errors_count: number of ext4 errors
* /sys/fs/ext4/<partition>/warning_count: number of ext4 warning log messages
* /sys/fs/ext4/<partition>/msg_count: number of other ext4 log messages

Signed-off-by: Muhammad Shahzeb <[email protected]>
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 this pull request may close these issues.

None yet

3 participants