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

Update smart input plugin to support more drive types #5765

Merged
merged 9 commits into from
May 7, 2019

Conversation

glinton
Copy link
Contributor

@glinton glinton commented Apr 24, 2019

Resolves #5740

  • sas drives

Resolves #4720
Resolves #5790

  • special ssd cases

Resolves #4707

  • --- as threshold value

Resolves #4169

  • support nvme drives

@glinton glinton added fix pr to fix corresponding bug area/smart labels Apr 24, 2019
@glinton glinton added this to the 1.11.0 milestone Apr 24, 2019
plugins/inputs/smart/smart.go Outdated Show resolved Hide resolved
plugins/inputs/smart/smart.go Outdated Show resolved Hide resolved
plugins/inputs/smart/smart_test.go Outdated Show resolved Hide resolved
plugins/inputs/smart/smart_test.go Show resolved Hide resolved
plugins/inputs/smart/smart.go Show resolved Hide resolved
// Power Cycles: 472
nvmePowerCycleAttr = regexp.MustCompile("^Power Cycles:\\s+(.*)$")
// Power On Hours: 6,038
nvmePowerOnAttr = regexp.MustCompile("^Power On Hours:\\s+(.*)$")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is okay for now, but I think in the future we shouldn't add any additional fields until we have a more efficient way to parse the output. We don't want to end up running 20+ regex per line. Maybe we will classify the line using a single regex and then parse further once we know which pattern to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, this isn't technically an additional field, just the way to parse it from a different device type.

Copy link
Contributor

Choose a reason for hiding this comment

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

My concern is more about the way we are parsing the output, and how it will scale as we add additional regular expressions. Right now it is essentially number-of-lines * number-of-regex, and for each field/attr we need another regex. It should be possible to change this to number-of-lines * 2 or better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I too found that disgusting. I had thought about refactoring that part, but felt the speed difference wouldn't be worth the effort. Maybe we should really evaluate that?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is probably fine for this pull request, but I don't think we can continue to add more regex with the current strategy for much longer.

Choose a reason for hiding this comment

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

I don't see any Percentage Used included. I suppose this is one of the more important attributes to monitor. I know the regex way is not the way to go and the amount of attributes should be kept to a minimum, but could this very important attribute be added as well? Especially in high-write environments this is a vital measurement.

Copy link
Contributor

Choose a reason for hiding this comment

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

One more won't be the end of the world, can you open a new feature request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sg-jorrit I intentionally didn't include percentage used because that is already being collected (and seems to fit better) in the disk input plugin, but I suppose there's no harm in collecting the same thing in multiple places

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, but might be wrong, that the percentage used here is the SSD wear: how much of the expected write cycle of the drive has been used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, now that makes sense

plugins/inputs/smart/smart.go Show resolved Hide resolved
plugins/inputs/smart/smart.go Outdated Show resolved Hide resolved
plugins/inputs/smart/smart.go Outdated Show resolved Hide resolved
plugins/inputs/smart/smart.go Outdated Show resolved Hide resolved
@danielnelson danielnelson merged commit 0d66ed7 into master May 7, 2019
@danielnelson danielnelson deleted the bugfix/5740 branch May 7, 2019 22:20
hwaastad pushed a commit to hwaastad/telegraf that referenced this pull request Jun 13, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/smart fix pr to fix corresponding bug
Projects
None yet
3 participants