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

collector/diskstats: Add labels and metrics from udev #2404

Merged
merged 7 commits into from
Jul 6, 2022

Commits on Jul 5, 2022

  1. collector/diskstats: Add labels and metrics from udev

    Add labels to the `node_disk_info` metric extracted from udev, such as `model`,
    `path`, `revision`, `serial` and `wwn`.
    
    Also add a few metrics related to filesystem and device mapper, which are also
    extracted from udev information.
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    727cca0 View commit details
    Browse the repository at this point in the history
  2. collector/diskstats: Don't use functions from Go 1.18

    Since we need to support Go 1.17, don't use `strings.Cut()` which was
    introduced in Go 1.18.
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    be94455 View commit details
    Browse the repository at this point in the history
  3. collector: Make udev data path optional

    Instead of hard-coding the path to `/run/udev/data`, intoduce a
    `--path.udev.data` flag that defaults to that value.
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    ed06af3 View commit details
    Browse the repository at this point in the history
  4. collector/diskstats: Add fixtures for udev data

    Now that we read some data from `/run/udev/data`, add the corresponding
    fixtures and update the expected test results accordingly.
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    c9574fb View commit details
    Browse the repository at this point in the history
  5. end-to-end-test.sh: Use udev fixture and update output

    Set the `--path.udev.data` flag to point to the udev fixture, and update the
    output fixture with
    
    ```console
    $ ./end-to-end-test.sh -u
    ```
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    336b68f View commit details
    Browse the repository at this point in the history
  6. collector/diskstats: Only get device properties from udev

    When parsing udev data, skip lines that don't start with `E:`.
    
    Lines prefixed with `E:` represent device properties, as documented in
    udevadm(8).
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    76273ea View commit details
    Browse the repository at this point in the history
  7. collector/diskstats: Ignore udev when directory unreadable

    Log a single error message when the udev data directory (`/run/udev/data` by
    default) is unreadable, and then don't try to get device properties out of it.
    
    Also lower the log level from error to debug when we can't parse the udev files
    properly, since these messages would be sent every time the node exporter gets
    scraped.
    
    Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
    BenoitKnecht committed Jul 5, 2022
    Configuration menu
    Copy the full SHA
    e6e1b4d View commit details
    Browse the repository at this point in the history