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

Include DEVLINKS in available diskio udev properties #5116

Merged
merged 19 commits into from
Dec 13, 2018

Conversation

dbergmanskytap
Copy link
Contributor

@dbergmanskytap dbergmanskytap commented Dec 5, 2018

Partial fix for #3663. The diskio plugin claims to grab udev properties when specified, but can't actually grab all of them due to the way it is written. One property it didn't grab is "DEVLINKS." Our company, Skytap, has a business need for using diskio to tag with DEVLINKS, and it was only a few lines of code to add that capability.

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@glinton glinton added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Dec 6, 2018
@glinton glinton added this to the 1.10.0 milestone Dec 6, 2018
@@ -14,6 +14,7 @@ import (
var nullDiskInfo = []byte(`
E:MY_PARAM_1=myval1
E:MY_PARAM_2=myval2
S:foo/bar/devlink foo/bar/devlink1
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be multiple lines like:

S:foo/bar/devlink
S:foo/bar/devlink1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, my mistake. I will update accordingly.

@@ -47,6 +48,7 @@ func TestDiskInfo(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, "myval1", di["MY_PARAM_1"])
assert.Equal(t, "myval2", di["MY_PARAM_2"])
assert.Equal(t, "foo/bar/devlink foo/bar/devlink1", di["DEVLINKS"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on running udevadm we should prepend "/dev/" to the links: /dev/foo/bar/devlink /dev/foo/bar/devlink1. I'm not sure if there are situations where the prefix would be something other than /dev, maybe in docker, but I think we could assume it for now unless we have a way to determine this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point (although it really demands a change to the function itself). I may try to check docker just to see, but otherwise I will definitely do this.

@@ -19,6 +19,9 @@ The diskio input plugin gathers metrics about disk traffic and timing.
## Currently only Linux is supported via udev properties. You can view
## available properties for a device by running:
## 'udevadm info -q property -n /dev/sda'
## Note: Most, but not all, udev properties can be accessed this way. Properties
## that are currently accessible include the "IS_*" series and the "DEVLINKS"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be able to access any of the E: values, so that would be at least ID* and DM* and probably others. Might be easier to document fields that cannot be looked up: DEVTYPE, DEVNAME, DEVPATH.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

@dbergmanskytap
Copy link
Contributor Author

@danielnelson I think you should be satisfied now

@danielnelson danielnelson merged commit 6b5ddbb into influxdata:master Dec 13, 2018
@dbergmanskytap
Copy link
Contributor Author

Woohoo! Thanks!

@danielnelson
Copy link
Contributor

Thank you!

trevorwhitney pushed a commit to trevorwhitney/telegraf that referenced this pull request Feb 14, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants