Skip to content

Expose network link speed #300

Description

@syepes

It would be nice if the exporter could expose the network interface link speed, this would permit us to calculate net utilization %

Activity

  1. SuperQ commented on Sep 7, 2016

    @SuperQ
    Member

    If this is available via proc/sysfs it should be possible. If it's available via netlink it's also possible, but we don't have support for this yet.

  2. juliusv commented on Sep 8, 2016

    @juliusv
    Member

    Seems the Linux way is an ioctl :-/

    http://stackoverflow.com/questions/2872058/get-link-speed-programmatically

    Confirmed that ethtool also uses this to get interface stats.

  3. juliusv commented on Sep 8, 2016

    @juliusv
    Member

    Ah, /sys/class/net/<device>/speed seems to work in some cases. At least it did for me for eth0.

    See also http://stackoverflow.com/questions/36262078/how-to-get-network-speed-in-linux-using-golang

  4. alwqx commented on Mar 28, 2017

    @alwqx

    +1

  5. SuperQ commented on Aug 29, 2017

    @SuperQ
    Member

    It would also be nice to directly expose link states. Looking over the code/strace of ip link, the tool gets things from netlink. But similar information is available via /sys/class/net/...

    $ ip link
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
        link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
        link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    

    This may also provide a nice info metric that would let users map devices to mac address.

  6. SuperQ commented on Aug 29, 2017

    @SuperQ
    Member
  7. mdlayher commented on Aug 29, 2017

    @mdlayher
    Contributor

    This screams rtnetlink to me. Probably doable, but I'm working on some improvements to my netlink packages before I have time to tackle this.

  8. klatys commented on Feb 27, 2018

    @klatys
    Contributor

    hi, any progress on this one? Thanks

  9. SuperQ commented on Feb 27, 2018

    @SuperQ
    Member

    This is also related to #794. We need to add support for the sysfs data in the procfs library, or as @mdlayher says, implement this via netlink.

    @klatys Any ability to sponsor this work? As the node_exporter is a purely volunteer maintained project, we currently don't have the resources to implement things on any kind of schedule. 😢

  10. klatys commented on Feb 28, 2018

    @klatys
    Contributor

    @SuperQ I suppose we can help out with that :) it's just a quick draft, but how about this

  11. SuperQ commented on Feb 28, 2018

    @SuperQ
    Member

    @klatys We're trying to move more of the procfs/sysfs parsing code to our procfs librarary so the code is more reusable.

  12. klatys commented on Feb 28, 2018

    @klatys
    Contributor

    Np, I’ll check it out and get back to you.

  13. klatys commented on Mar 1, 2018

    @klatys
    Contributor

    @SuperQ so I suppose this would be step 1
    followed by implementing this into node exporter?

  14. SuperQ commented on Mar 1, 2018

    @SuperQ
    Member

    @klatys Yes, something like that, but there's no need to do anything with json, just use Go structs. Take a look at the other code in the procfs repo.

  15. klatys commented on Mar 3, 2018

    @klatys
    Contributor

    @SuperQ yes, that was wrong naming of a tag, the struct is actually used, the tag I took was based on net_dev.go. I changed it's name - It's for identifying filename to be scraped (which is different from other modules as far as I can tell). I opened a pull request, hope it's ok now, otherwise feel free to comment

  16. SuperQ commented on Mar 3, 2018

    @SuperQ
    Member

    Thanks! It looks OK to me, but I'd like to have the other maintainers take a look at it.

  17. klatys commented on Jul 16, 2018

    @klatys
    Contributor

    Solved by #851

  18. added a commit that references this issue on Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions