Skip to content

Comments

Add text file utility for SMART metrics#354

Merged
discordianfish merged 1 commit intomasterfrom
superq/smart_metrics
Dec 21, 2016
Merged

Add text file utility for SMART metrics#354
discordianfish merged 1 commit intomasterfrom
superq/smart_metrics

Conversation

@SuperQ
Copy link
Member

@SuperQ SuperQ commented Nov 27, 2016

Add a utility to parse the output of smartctl.

  • Scans all disks.
  • Prints metrics for smartctl --info.
  • Prints metrics for smartctl --attributes.

Add a utility to parse the output of `smartctl`.
* Scans all disks.
* Prints metrics for `smartctl --info`.
* Prints metrics for `smartctl --attributes`.
# Get the SMART information
/usr/sbin/smartctl -i -d "${type}" "${disk}" | parse_smartctl_info "${disk}" "${type}"
# Get the SMART attributes
/usr/sbin/smartctl -A -d "${type}" "${disk}" | parse_smartctl_attributes "${disk}" "${type}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be useful to add a gauge with "number of 'unknown attributes' found", both not to lose information and to sense new drives not yet in smartmontools database (i.e. usually with a high number of unknown attributes, IME)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh, that's an interesting idea. Also maybe a datestamp of the database file so you can monitor for out of date databases that way. But I think these might be interesting for a later release.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

@SuperQ I'd also avoid calling smartctl twice

Copy link
Member Author

Choose a reason for hiding this comment

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

@discordianfish We've been running this in production for a long time without issues. Having it do both in one shot makes for a much more complicated script.

Maybe sometime I can re-write this in python, but it works fine for now.

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.

See comment

# Get the SMART information
/usr/sbin/smartctl -i -d "${type}" "${disk}" | parse_smartctl_info "${disk}" "${type}"
# Get the SMART attributes
/usr/sbin/smartctl -A -d "${type}" "${disk}" | parse_smartctl_attributes "${disk}" "${type}"
Copy link
Member

Choose a reason for hiding this comment

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

@SuperQ I'd also avoid calling smartctl twice

@discordianfish
Copy link
Member

Fine with me, those are examples and not maintained as the core functionality anyways.

@discordianfish discordianfish merged commit 445f9c1 into master Dec 21, 2016
@discordianfish discordianfish deleted the superq/smart_metrics branch December 21, 2016 11:57
@SuperQ SuperQ mentioned this pull request Jan 15, 2017
tamcore pushed a commit to gitgrave/node_exporter that referenced this pull request Oct 22, 2024
Signed-off-by: Evan Lezar <evanlezar@gmail.com>
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.

3 participants