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

Added IP attribute when interface IP address is available #98

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MohammedSentry
Copy link
Contributor

No description provided.

@MohammedSentry MohammedSentry linked an issue Jul 22, 2024 that may be closed by this pull request
@@ -190,7 +190,7 @@ monitors:
simple:
sources:
# Name;PacketsOutboundDiscarded;PacketsReceivedDiscarded;PacketsSentPersec;PacketsReceivedPersec;PacketsOutboundErrors;PacketsReceivedErrors
networkInformation:
networkInterfacePrefs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
networkInterfacePrefs:
networkInterfacePerfs:

query: >
SELECT Description,
IPAddress
FROM Win32_NetworkAdapterConfiguration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Win32_NetworkAdapterConfiguration lists all network adapters (incl. many WAN and virtual network cards), while Win32_PerfRawData_Tcpip_NetworkInterface lists only network interfaces (Windows makes a slight difference between the 2 concepts).

So:

  1. you either join Win32_NetworkAdapterConfiguration with Win32_PerfRawData_Tcpip_NetworkAdapter, and provide performance information for all "adapters", including WAN miniports and virtual cards,
  2. or join Win32_PerfRawData_Tcpip_NetworkInterface (left) with Win32_NetworkAdapterConfiguration (right) to make sure only the physical interfaces are listed in the result of the join operation

Prometheus' windows_exporter seems to have chosen the 2nd option, so that's our preferred one to!

script: 'BEGIN {FS=OFS=";"} {gsub(/[^a-zA-Z0-9]/, " ", $2); print $0}'
- type: duplicateColumn
column: 3
- type: awk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This awk script can be replaced with a simple Replace compute step:

- replace: "|"
- replaceBy: " "
- column: 4

(or you could combine all 4 compute steps into a single AWK script)

mapping:
source: ${source::networkInformation}
attributes:
id: $1
id: $2
ip: $4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Otel semantic conventions, the IP addresses is to be represented with the network.local.address attribute.

See: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/

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

Successfully merging this pull request may close these issues.

System connectors - Add the IP address
3 participants