Skip to content

Added IP attribute when interface IP address is available#98

Open
MohammedSentry wants to merge 3 commits intomainfrom
97-system-connectors-add-ip-address
Open

Added IP attribute when interface IP address is available#98
MohammedSentry wants to merge 3 commits intomainfrom
97-system-connectors-add-ip-address

Conversation

@MohammedSentry
Copy link
Contributor

No description provided.

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

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
Contributor

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
Contributor

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)

attributes:
id: $1
id: $2
ip: $4
Copy link
Contributor

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