Update smart input plugin to support more drive types#5765
Update smart input plugin to support more drive types#5765danielnelson merged 9 commits intomasterfrom
Conversation
| // Power Cycles: 472 | ||
| nvmePowerCycleAttr = regexp.MustCompile("^Power Cycles:\\s+(.*)$") | ||
| // Power On Hours: 6,038 | ||
| nvmePowerOnAttr = regexp.MustCompile("^Power On Hours:\\s+(.*)$") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Again, this isn't technically an additional field, just the way to parse it from a different device type.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
One more won't be the end of the world, can you open a new feature request?
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Ah, now that makes sense
Resolves #5740
Resolves #4720
Resolves #5790
Resolves #4707
---as threshold valueResolves #4169