windows_exporter icon indicating copy to clipboard operation
windows_exporter copied to clipboard

Expose addresses for interfaces

Open JJinMaine opened this issue 5 years ago • 7 comments

Hello,

I can't quite figure out how to get the list of currently assigned ipv4 IP addresses to be available at the /metrics endpoint. I can see the NIC name and all the NIC stats but there's no ipv4 addresses listed. Am I doing it wrong? Is there a non-default option I need to enable to get it working? My plan is to show a table of assigned IP addresses along with same stats and I'm hoping this is an easy fix. Thanks!

Jim

JJinMaine avatar Oct 07 '19 15:10 JJinMaine

Hi @JJinMaine, I do not think we have a good way of exposing that information right now. In general, there could be any number of IP addresses per interface, which also will make it a bit more complicated to query with. We would need to do something like wmi_net_adress{nic="Ethernet",address="10.0.0.1"} 1 etc for each nic/address pair, I think, and then you'd need to write queries something like wmi_net_bytes_total * on(nic) wmi_net_address{address="10.0.0.1"} etc. Which works okay for nics with single IPs, but less obvious with multiple addresses.

carlpett avatar Oct 07 '19 15:10 carlpett

Hi @carlpett, That's unfortunate, but it is what it is. Do you think it would be worthwhile submitting a feature request for something like this or has it been addressed previously and already on a backlog for the future? I didn't see anything as I was searching around but I don't want to create any duplicate work.

Thanks!

Jim

JJinMaine avatar Oct 07 '19 17:10 JJinMaine

Let's turn this into a feature request instead :) As I mentioned, I'm not completely sure how this would best be implemented, but perhaps someone in the community has an idea

carlpett avatar Oct 07 '19 19:10 carlpett

Just came across this issue while looking for the same info as Jim.

IPv4 is just a 32-bit integer. We traditionally express it in dot-decimal notation, but it can also be rendered and stored as a normal decimal. Because it's only 32 bits, it can fit inside of a single Prometheus time series value (which are 64-bit floats).

So I think something like wmi_net_address{nic="Ethernet"} 167772161 would work for IPv4.

IPv6 is a bit trickier since it's 128-bit. I'm still not sure how best to store that.

@carlpett and @JJinMaine, what are your thoughts?

EccentricVamp avatar Jun 27 '22 21:06 EccentricVamp

It'd be nice to have some stuff like we have on the node_exporter with node_network_route_info

node_network_route_info{dest="10.1.1.0/24", device="eth0", priority="0", proto="kernel", src="10.1.1.71"} 1

danpoltawski avatar Aug 22 '22 08:08 danpoltawski

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

github-actions[bot] avatar Nov 25 '23 05:11 github-actions[bot]

Still seems like a worthwhile feature, please don't close.

danpoltawski avatar Nov 30 '23 17:11 danpoltawski