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 net don't show nic name as expected #1835

Open
SupraOva opened this issue Jan 16, 2025 · 5 comments
Open

Collector net don't show nic name as expected #1835

SupraOva opened this issue Jan 16, 2025 · 5 comments
Labels

Comments

@SupraOva
Copy link

Current Behavior

I was trying the new version of windows_exporter (0.30.0), and I noticed that the 'net' collector was not returning the correct information.

0.28.1
image

TYPE windows_net_bytes_sent_total counter

windows_net_bytes_sent_total{nic="vmxnet3_Ethernet_Adapter"} 2.532306e+06
windows_net_bytes_sent_total{nic="vmxnet3_Ethernet_Adapter__2"} 3.2228776e+09

0.30.0
image

TYPE windows_net_bytes_sent_total counter

windows_net_bytes_sent_total{nic="vmxnet3 Ethernet Adapter"} 1.8390094e+07
windows_net_bytes_sent_total{nic="vmxnet3 Ethernet Adapter _2"} 1.5852902351e+10

NIC names are spelled differently between 0.28.1 and 0.30.0

and also a different spelling in the metrics windows_net_nic_address_info

image

TYPE windows_net_nic_address_info gauge

windows_net_nic_address_info{address="x.x.x.x",family="ipv4",friendly_name="xxx",nic="vmxnet3 Ethernet Adapter"} 1
windows_net_nic_address_info{address="x.x.x.x",family="ipv4",friendly_name="xxx",nic="vmxnet3 Ethernet Adapter #2"} 1

Expected Behavior

is it possible to normalize all this and also it would be interesting to have the “friendly_name” in all metrics containing “nic=”

Steps To Reproduce

install version 0.30.0 and enable the "net" collector

Environment

  • windows_exporter Version: 0.30.0
  • Windows Server Version: Windows Server 2022

windows_exporter logs

time=2025-01-16T09:15:06.409Z level=DEBUG source=main.go:196 msg="logging has Started"
time=2025-01-16T09:15:06.409Z level=DEBUG source=main.go:337 msg="setting process priority to normal"
time=2025-01-16T09:15:06.426Z level=INFO source=update.go:107 msg="update collector is in an experimental state! The configuration and metrics may change in future. Please report any issues." collector=update
time=2025-01-16T09:15:06.435Z level=WARN source=os.go:108 msg="The os collect holds a number of deprecated metrics and will be removed mid 2025. See https://github.com/prometheus-community/windows_exporter/pull/1596 for more information." collector=os
time=2025-01-16T09:15:07.759Z level=DEBUG source=update.go:288 msg="search for updates took 1.2939364s" collector=update
time=2025-01-16T09:15:07.881Z level=DEBUG source=terminal_services.go:159 msg="host is not a connection broker skipping Connection Broker performance metrics."
time=2025-01-16T09:15:07.893Z level=INFO source=main.go:311 msg="Running as NT AUTHORITY\\SYSTEM"
time=2025-01-16T09:15:07.893Z level=INFO source=main.go:228 msg="Enabled collectors: cpu, cpu_info, logical_disk, diskdrive, net, os, service, system, tcp, udp, memory, logon, process, terminal_services, license, time, update, smb"
time=2025-01-16T09:15:07.893Z level=INFO source=main.go:246 msg="starting windows_exporter in 1.4864495s" version=0.30.0 branch=HEAD revision=86e6d12518d2fa7f8f2f632634ade3aaa34fba22 goversion=go1.23.4 builddate=20250114-22:51:51 maxprocs=4
time=2025-01-16T09:15:07.895Z level=INFO source=tls_config.go:347 msg="Listening on" address=[::]:9182
time=2025-01-16T09:15:07.895Z level=INFO source=tls_config.go:350 msg="TLS is disabled." http2=false address=[::]:9182
time=2025-01-16T09:15:24.542Z level=DEBUG source=collect.go:220 msg="collector system succeeded after 2.3617ms, resulting in 8 metrics"
time=2025-01-16T09:15:24.546Z level=DEBUG source=collect.go:220 msg="collector update succeeded after 6.4178ms, resulting in 2 metrics"
time=2025-01-16T09:15:24.546Z level=DEBUG source=collect.go:220 msg="collector smb succeeded after 6.4178ms, resulting in 40 metrics"
time=2025-01-16T09:15:24.550Z level=DEBUG source=collect.go:220 msg="collector license succeeded after 10.4985ms, resulting in 5 metrics"
time=2025-01-16T09:15:24.550Z level=DEBUG source=collect.go:220 msg="collector time succeeded after 11.1404ms, resulting in 8 metrics"
time=2025-01-16T09:15:24.550Z level=DEBUG source=collect.go:220 msg="collector logon succeeded after 11.1404ms, resulting in 43 metrics"
time=2025-01-16T09:15:24.554Z level=DEBUG source=collect.go:220 msg="collector cpu succeeded after 14.5472ms, resulting in 77 metrics"
time=2025-01-16T09:15:24.555Z level=DEBUG source=collect.go:220 msg="collector cpu_info succeeded after 15.6599ms, resulting in 14 metrics"
time=2025-01-16T09:15:24.555Z level=DEBUG source=collect.go:220 msg="collector diskdrive succeeded after 16.0784ms, resulting in 108 metrics"
time=2025-01-16T09:15:24.558Z level=DEBUG source=collect.go:220 msg="collector terminal_services succeeded after 18.9452ms, resulting in 25 metrics"
time=2025-01-16T09:15:24.560Z level=DEBUG source=collect.go:220 msg="collector os succeeded after 20.9849ms, resulting in 11 metrics"
time=2025-01-16T09:15:24.563Z level=DEBUG source=collect.go:220 msg="collector memory succeeded after 23.9979ms, resulting in 35 metrics"
time=2025-01-16T09:15:24.564Z level=DEBUG source=collect.go:220 msg="collector logical_disk succeeded after 25.23ms, resulting in 85 metrics"
time=2025-01-16T09:15:24.566Z level=DEBUG source=collect.go:220 msg="collector udp succeeded after 26.6908ms, resulting in 8 metrics"
time=2025-01-16T09:15:24.566Z level=DEBUG source=collect.go:220 msg="collector tcp succeeded after 26.6908ms, resulting in 22 metrics"
time=2025-01-16T09:15:24.582Z level=DEBUG source=collect.go:220 msg="collector net succeeded after 42.4184ms, resulting in 29 metrics"
time=2025-01-16T09:15:24.603Z level=DEBUG source=collect.go:220 msg="collector service succeeded after 63.7695ms, resulting in 3205 metrics"
time=2025-01-16T09:15:24.619Z level=DEBUG source=collect.go:220 msg="collector process succeeded after 79.2974ms, resulting in 4246 metrics"
time=2025-01-16T09:15:54.541Z level=DEBUG source=collect.go:220 msg="collector os succeeded after 4.9393ms, resulting in 11 metrics"
time=2025-01-16T09:15:54.541Z level=DEBUG source=collect.go:220 msg="collector cpu succeeded after 6.2755ms, resulting in 77 metrics"
time=2025-01-16T09:15:54.542Z level=DEBUG source=collect.go:220 msg="collector time succeeded after 6.2963ms, resulting in 8 metrics"
time=2025-01-16T09:15:54.542Z level=DEBUG source=collect.go:220 msg="collector update succeeded after 6.1058ms, resulting in 2 metrics"
time=2025-01-16T09:15:54.542Z level=DEBUG source=collect.go:220 msg="collector smb succeeded after 6.1058ms, resulting in 40 metrics"
time=2025-01-16T09:15:54.547Z level=DEBUG source=collect.go:220 msg="collector terminal_services succeeded after 11.995ms, resulting in 25 metrics"
time=2025-01-16T09:15:54.547Z level=DEBUG source=collect.go:220 msg="collector license succeeded after 11.4629ms, resulting in 5 metrics"
time=2025-01-16T09:15:54.547Z level=DEBUG source=collect.go:220 msg="collector tcp succeeded after 11.3762ms, resulting in 22 metrics"
time=2025-01-16T09:15:54.547Z level=DEBUG source=collect.go:220 msg="collector system succeeded after 11.4629ms, resulting in 8 metrics"
time=2025-01-16T09:15:54.547Z level=DEBUG source=collect.go:220 msg="collector net succeeded after 11.3762ms, resulting in 29 metrics"
time=2025-01-16T09:15:54.547Z level=DEBUG source=collect.go:220 msg="collector logon succeeded after 11.2724ms, resulting in 43 metrics"
time=2025-01-16T09:15:54.549Z level=DEBUG source=collect.go:220 msg="collector logical_disk succeeded after 14.6054ms, resulting in 85 metrics"
time=2025-01-16T09:15:54.551Z level=DEBUG source=collect.go:220 msg="collector udp succeeded after 15.1539ms, resulting in 8 metrics"
time=2025-01-16T09:15:54.551Z level=DEBUG source=collect.go:220 msg="collector memory succeeded after 15.0672ms, resulting in 35 metrics"
time=2025-01-16T09:15:54.561Z level=DEBUG source=collect.go:220 msg="collector diskdrive succeeded after 26.07ms, resulting in 108 metrics"
time=2025-01-16T09:15:54.581Z level=DEBUG source=collect.go:220 msg="collector cpu_info succeeded after 46.2482ms, resulting in 14 metrics"
time=2025-01-16T09:15:54.588Z level=DEBUG source=collect.go:220 msg="collector service succeeded after 52.5374ms, resulting in 3205 metrics"
time=2025-01-16T09:15:54.618Z level=DEBUG source=collect.go:220 msg="collector process succeeded after 82.7243ms, resulting in 4268 metrics"

Anything else?

No response

@jkroepke
Copy link
Member

jkroepke commented Jan 16, 2025

It seems like the different version of Windows APIs do sanitize name in different ways. While on 0.28.0 space also replaced with an _, this is not longer the case.

However, I agree that the nic label in windows_net_nic_address_info should be equal with the nic label from windows_net_bytes_sent_total. I will add sanitizer that transform a # into a _ as well.

@SupraOva
Copy link
Author

It seems like the different version of Windows APIs do sanitize name in different ways. While on 0.28.0 space also replaced with an _, this is not longer the case.

However, I agree that the nic label in windows_net_nic_address_info should be equal with the nic label from windows_net_bytes_sent_total. I will add sanitizer that transform a # into a _ as well.

Thanks! And if it's possible to add the “friendly_name” in all metrics containing “nic=” ? It would help to easily identify a NIC.

@jkroepke
Copy link
Member

jkroepke commented Jan 16, 2025

Due my understanding how prometheus, I can't recommend that. The general idea is to have a info metric (I do the same for process and services, too) and then using promql capabilities to join labels.

Something like this may work:

windows_net_bytes_sent_total * on(instance, nic) group_left(friendly_name) windows_net_nic_address_info

and should result into the expected behavior.

Ref: https://ypereirareis.github.io/blog/2020/02/21/how-to-join-prometheus-metrics-by-label-with-promql/

@SupraOva
Copy link
Author

Due my understanding how prometheus, I can't recommend that. The general idea is to have a info metric (I do the same for process and services, too) and then using promql capabilities to join labels.

Something like this may work:

windows_net_bytes_sent_total * on(instance, nic) group_left(friendly_name) windows_net_nic_address_info

and should result into the expected behavior.

Ref: https://ypereirareis.github.io/blog/2020/02/21/how-to-join-prometheus-metrics-by-label-with-promql/

Got it! The PromQL query you provided works. The nic name on all collectors must be the same to match.

@jkroepke
Copy link
Member

The nic name on all collectors must be the same to match.

Yeah, that what I mean in my first response.

However, I agree that the nic label in windows_net_nic_address_info should be equal with the nic label from windows_net_bytes_sent_total.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants