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

collector/mdadm: Support RAID metrics #3031

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rexagod
Copy link
Contributor

@rexagod rexagod commented May 29, 2024

Use sysfs for RAID stats. Also added tests for the collector.

Fixes: #842

@rexagod rexagod marked this pull request as draft May 29, 2024 07:41
@rexagod rexagod marked this pull request as ready for review May 29, 2024 07:50
@rexagod rexagod force-pushed the 842 branch 2 times, most recently from 62d8a5a to a75d6b8 Compare May 29, 2024 07:52
@rexagod
Copy link
Contributor Author

rexagod commented Jun 21, 2024

Not sure what's causing the error here, the logs seem okay (no level=error lines)?

@rexagod rexagod force-pushed the 842 branch 2 times, most recently from 711ae52 to 59a5f2d Compare June 21, 2024 23:39
@discordianfish
Copy link
Member

The log indicates a diff between metrics and expected metrics:

--- collector/fixtures/e2e-output.txt 2024-06-21 23:39:55.007539384 +0000
+++ /tmp/node_exporter_e2e_test.UZ2v15/e2e-output.txt 2024-06-21 23:42:36.000289912 +0000
@@ -1581,6 +1581,14 @@
node_md_blocks_synced{device="md7"} 7.813735424e+09
node_md_blocks_synced{device="md8"} 1.6775552e+07
node_md_blocks_synced{device="md9"} 0
+# HELP node_md_degraded Number of degraded disks on device.
+# TYPE node_md_degraded gauge
+node_md_degraded{device="md0"} 0
+node_md_degraded{device="md1"} 0
+node_md_degraded{device="md10"} 0
+node_md_degraded{device="md4"} 0
+node_md_degraded{device="md5"} 1
+node_md_degraded{device="md6"} 1

HELP node_md_disks Number of active/failed/spare disks of device.

TYPE node_md_disks gauge

node_md_disks{device="md0",state="active"} 2
@@ -1653,6 +1661,14 @@
node_md_disks_required{device="md7"} 4
node_md_disks_required{device="md8"} 2
node_md_disks_required{device="md9"} 4
+# HELP node_md_raid_disks Number of raid disks on device.
+# TYPE node_md_raid_disks gauge
+node_md_raid_disks{device="md0"} 2
+node_md_raid_disks{device="md1"} 2
+node_md_raid_disks{device="md10"} 4
+node_md_raid_disks{device="md4"} 3
+node_md_raid_disks{device="md5"} 3
+node_md_raid_disks{device="md6"} 4

HELP node_md_state Indicates the state of md-device.

TYPE node_md_state gauge

node_md_state{device="md0",state="active"} 1

@rexagod
Copy link
Contributor Author

rexagod commented Jul 16, 2024

Ah! It seems I didn't update the e2e output manifest, so the unit test was working fine for me, but the e2e ones were failing. Updated.

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.

LGTM!

@rexagod
Copy link
Contributor Author

rexagod commented Aug 13, 2024

cc @SuperQ 🙂

package collector

import (
"github.com/go-kit/log"
Copy link
Member

Choose a reason for hiding this comment

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

This needs a rebase to pick up the replacement slog logging.

Use `sysfs` for RAID stats.

Signed-off-by: Pranshu Srivastava <[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.

Consider using sysfs for md collector
3 participants