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

diskio: ability to report only devices, not partitions #4238

Closed
randallt opened this issue Jun 5, 2018 · 11 comments
Closed

diskio: ability to report only devices, not partitions #4238

randallt opened this issue Jun 5, 2018 · 11 comments
Labels
area/system feature request Requests for new plugin and for new features to existing plugins

Comments

@randallt
Copy link

randallt commented Jun 5, 2018

Feature Request

Proposal:

Easily filter partitions from being reported.

Current behavior:

Have to use the "devices = [ ... ]" mechanism to try to filter out partitions, such as
devices = [ "sd?" ]
to only get sda, sdb, etc., without getting sda1, sda2, etc. However, if my device naming changes, this will no longer apply.

Desired behavior:

Can easily ignore partitions lines by specifying
ignore_partitions = true
or equivalent. A way to do this on linux is to only match devices with a minor number zero in /proc/diskstats.

Use case: [Why is this important (helps with prioritizing requests)]

We use system images that have several devices and partitions. For the diskio plugin, this is way too chatty. We would like to only report on the devices, without having to guess at a device naming convention.

@randallt randallt changed the title diskio: ability to only report devices, not partitions diskio: ability to report only devices, not partitions Jun 5, 2018
@danielnelson
Copy link
Contributor

I'm not sure the minor number being 0 would work in all cases, on my system the first device mapper partition also matches:

   8       0 sda 355695 852 14086167 101987 2849736 1451871 128171168 3720277 0 1150248 3819033
   8       1 sda1 175 0 15104 40 0 0 0 0 0 36 40
   8       2 sda2 354900 852 14058879 101846 2302331 1451871 128171168 3178906 0 791621 3277655
 253       0 dm-0 355762 0 14052208 182310 4305343 0 128171168 35355967 0 1521174 35551163
 253       1 dm-1 174838 0 5459754 65744 1241146 0 19664928 13787844 0 460953 13871589
 253       2 dm-2 45 0 2336 24 0 0 0 0 0 16 24
 253       3 dm-3 152252 0 3033274 58118 2003500 0 86875136 19821232 0 531269 19880477
 253       4 dm-4 9035 0 3562490 45286 12231 0 1465880 121756 0 51714 167056
 253       5 dm-5 19501 0 1988690 13627 672278 0 20165224 1462586 0 501966 1476553

I wouldn't want to just move the guessing into the plugin, but perhaps we should add major/minor number to the tagset?

@danielnelson
Copy link
Contributor

I guess dm-0 is the full device mapper, but I still am unsure if this is always a valid way to determine the full disk.

@randallt
Copy link
Author

randallt commented Jun 5, 2018

Ah. Looks like you are right. Unfortunate. I see dm-0 as just another device--it is not cumulative for the others. Any other possible way to do this?

@danielnelson
Copy link
Contributor

Perhaps this heuristic will work well enough in your environment. What if we add major/minor as tags:

diskio,name=sda,major=8,minor=0 value=42

And then you can use tagpass/tagdrop to filter:

[[inputs.diskio]]
  # ... snip ...
  [inputs.diskio.tagpass]
    minor = "0"

@randallt
Copy link
Author

randallt commented Jun 5, 2018

No, I think you are right that major/minor doesn't work well enough for this. I would need those dm-* devices as well. I'm fine to close this as unworkable if there's no other way.

@danielnelson
Copy link
Contributor

Maybe this could work?:

[[inputs.diskio]]
  device_tags = ["ID_PART_ENTRY_NUMBER"]
  [inputs.diskio.tagdrop]
    ID_PART_ENTRY_NUMBER = "*"

@randallt
Copy link
Author

randallt commented Jun 5, 2018

You forgot the brackets:
...
device_tags = ["ID_PART_ENTRY_NUMBER"]
[inputs.diskio.tagdrop]
ID_PART_ENTRY_NUMBER = [ "*" ]

It doesn't work without them, but it does work with them, at least on my test system (Centos7 VM). Question is, can we shortcut this with a single config option?

@danielnelson
Copy link
Contributor

I believe we would want a cross platform way of doing this first, which might be challenging, but also I would want to see how much demand exists for an option like this.

@danielnelson danielnelson added feature request Requests for new plugin and for new features to existing plugins area/system labels Jun 5, 2018
@randallt
Copy link
Author

randallt commented Jun 6, 2018

Hmm, on second thought, it looks like we would want to exclude the device mapper, and just get metrics on the underlying devices.

@danielnelson
Copy link
Contributor

Can you add name = ["dm*"] to the tagdrop table?

@sspaink
Copy link
Contributor

sspaink commented Jul 12, 2022

Closing as there hasn't been any activity for quite sometime, if anyone is still interested in this please re-open or leave a comment. Thank you!

@sspaink sspaink closed this as completed Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/system feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

3 participants