Icinga / icinga-powershell-plugins

A collection of Windows check plugins for the Icinga PowerShell Framework
GNU General Public License v2.0
51 stars 28 forks source link

Invoke-IcingaCheckNetworkInterface 1.5.0 - missing some NICs #192

Open puseidr opened 3 years ago

puseidr commented 3 years ago

the check doesn't show all NCIs (only 4 of 7)

here an example:

PS C:\Windows\system32> Invoke-IcingaCheckNetworkInterface -Verbosity 3
[OK] Network Device Package: 4 Ok (All must be [OK])
\_ [OK] Interface Ethernet (All must be [OK])
   \_ [OK] eth 7: AdminLocked: False
   \_ [OK] eth 7: bytes received/sec: 44.28409B
   \_ [OK] eth 7: bytes sent/sec: 172.3303B
   \_ [OK] eth 7: bytes total/sec: 216.6663B
   \_ [OK] eth 7: Interface AdminStatus: Up
   \_ [OK] eth 7: Interface OperationalStatus: Up
   \_ [OK] eth 7: LinkSpeed: 425.984Mbit
   \_ [OK] eth 7: NetConnectionStatus: Connected
   \_ [OK] eth 7: packets outbound discarded: 0c
   \_ [OK] eth 7: packets outbound errors: 0c
   \_ [OK] eth 7: packets received discarded: 0c
   \_ [OK] eth 7: packets received errors: 0c
   \_ [OK] eth 7: packets received/sec: 0.722506c
   \_ [OK] eth 7: packets sent/sec: 2.02299c
   \_ [OK] eth 7: VlanID: 0
\_ [OK] Interface NIC2 switch b StorageSwitch (All must be [OK])
   \_ [OK] eth 4: AdminLocked: False
   \_ [OK] eth 4: bytes received/sec: 2.70MiB
   \_ [OK] eth 4: bytes sent/sec: 0B
   \_ [OK] eth 4: bytes total/sec: 2.69MiB
   \_ [OK] eth 4: Interface AdminStatus: Up
   \_ [OK] eth 4: Interface OperationalStatus: Up
   \_ [OK] eth 4: LinkSpeed: 10Gbit
   \_ [OK] eth 4: NetConnectionStatus: Connected
   \_ [OK] eth 4: packets outbound discarded: 0c
   \_ [OK] eth 4: packets outbound errors: 0c
   \_ [OK] eth 4: packets received discarded: 0c
   \_ [OK] eth 4: packets received errors: 0c
   \_ [OK] eth 4: packets received/sec: 2047.793c
   \_ [OK] eth 4: packets sent/sec: 328.4474c
   \_ [OK] eth 4: VlanID: 0
\_ [OK] Interface SLOT 1 Port 1 switch a StorageSwitch (All must be [OK])
   \_ [OK] eth 5: AdminLocked: False
   \_ [OK] eth 5: bytes received/sec: 2.41MiB
   \_ [OK] eth 5: bytes sent/sec: 0B
   \_ [OK] eth 5: bytes total/sec: 2.50MiB
   \_ [OK] eth 5: Interface AdminStatus: Up
   \_ [OK] eth 5: Interface OperationalStatus: Up
   \_ [OK] eth 5: LinkSpeed: 10Gbit
   \_ [OK] eth 5: NetConnectionStatus: Connected
   \_ [OK] eth 5: packets outbound discarded: 0c
   \_ [OK] eth 5: packets outbound errors: 0c
   \_ [OK] eth 5: packets received discarded: 0c
   \_ [OK] eth 5: packets received errors: 0c
   \_ [OK] eth 5: packets received/sec: 1977.203c
   \_ [OK] eth 5: packets sent/sec: 363.4281c
   \_ [OK] eth 5: VlanID: 0
\_ [OK] Interface SLOT 1 Port 2 switch b ComputeSwitch (All must be [OK])
   \_ [OK] eth 2: AdminLocked: False
   \_ [OK] eth 2: bytes received/sec: 20.67KiB
   \_ [OK] eth 2: bytes sent/sec: 0B
   \_ [OK] eth 2: bytes total/sec: 20.67KiB
   \_ [OK] eth 2: Interface AdminStatus: Up
   \_ [OK] eth 2: Interface OperationalStatus: Up
   \_ [OK] eth 2: LinkSpeed: 10Gbit
   \_ [OK] eth 2: NetConnectionStatus: Connected
   \_ [OK] eth 2: packets outbound discarded: 0c
   \_ [OK] eth 2: packets outbound errors: 0c
   \_ [OK] eth 2: packets received discarded: 0c
   \_ [OK] eth 2: packets received errors: 0c
   \_ [OK] eth 2: packets received/sec: 68.06094c
   \_ [OK] eth 2: packets sent/sec: 57.22137c
   \_ [OK] eth 2: VlanID: 0
| 'eth_2_bytes_sentsec'=0B;;;0;1250000000 'eth_2_bytes_receivedsec'=21164.24B;;;0;1250000000 'eth_2_packets_receivedsec'=68.06094c;; 'eth_2_packets_received_discarded'=0c;;;0;68.06094 'eth_2_packets_outbound_discarded'=0c;;;0;57.22137 'eth_2_packets_received_errors'=0c;;;0;68.06094 'eth_2_packets_sentsec'=57.22137c;; 'eth_2_bytes_totalsec'=21165.71B;;;0;1250000000 'eth_2_packets_outbound_errors'=0c;;;0;57.22137 'eth_4_packets_outbound_discarded'=0c;;;0;328.4474 'eth_4_packets_receivedsec'=2047.793c;; 'eth_4_packets_sentsec'=328.4474c;; 'eth_4_packets_received_discarded'=0c;;;0;2047.793 'eth_4_packets_outbound_errors'=0c;;;0;328.4474 'eth_4_packets_received_errors'=0c;;;0;2047.793 'eth_4_bytes_receivedsec'=2829076B;;;0;1250000000 'eth_4_bytes_sentsec'=0B;;;0;1250000000 'eth_4_bytes_totalsec'=2818835B;;;0;1250000000 'eth_7_packets_receivedsec'=0.722506c;; 'eth_7_bytes_totalsec'=216.6663B;;;0;53248000 'eth_7_packets_outbound_errors'=0c;;;0;2.02299 'eth_7_bytes_receivedsec'=44.28409B;;;0;53248000 'eth_7_packets_sentsec'=2.02299c;; 'eth_7_packets_outbound_discarded'=0c;;;0;2.02299 'eth_7_packets_received_errors'=0c;;;0;0.722506 'eth_7_bytes_sentsec'=172.3303B;;;0;53248000 'eth_7_packets_received_discarded'=0c;;;0;0.722506 'eth_5_linkspeed'=10000000000;; 'eth_4_linkspeed'=10000000000;; 'eth_7_linkspeed'=425984000;; 'eth_2_linkspeed'=10000000000;; 'eth_5_packets_received_errors'=0c;;;0;1977.203 'eth_5_packets_sentsec'=363.4281c;; 'eth_5_packets_outbound_discarded'=0c;;;0;363.4281 'eth_5_packets_received_discarded'=0c;;;0;1977.203 'eth_5_bytes_sentsec'=0B;;;0;1250000000 'eth_5_bytes_totalsec'=2617938B;;;0;1250000000 'eth_5_packets_outbound_errors'=0c;;;0;363.4281 'eth_5_bytes_receivedsec'=2522080B;;;0;1250000000 'eth_5_packets_receivedsec'=1977.203c;;
0

this server has 7 physical NICs and 3 vNICs (using Switch-Embedded-Teaming)

PS C:\Windows\system32> Get-NetAdapter|select Name, InterfaceDescription, ifIndex, Status, LinkSpeed | ft

Name                                 InterfaceDescription                                ifIndex Status       LinkSpeed
----                                 --------------------                                ------- ------       ---------
NIC1 switch a ComputeSwitch          Intel(R) Ethernet 10G 4P X710/I350 rNDC                  27 Up           10 Gbps
SLOT 1 Port 1 switch a StorageSwitch Intel(R) Ethernet Converged Network Adapter X710 #2      26 Up           10 Gbps
NIC3-WAN                             Intel(R) Gigabit 4P X710/I350 rNDC #2                    24 Not Present  0 bps
Ethernet                             Remote NDIS Compatible Device                            23 Up           426.0 Mbps
NIC2 switch b StorageSwitch          Intel(R) Ethernet 10G X710 rNDC                          22 Up           10 Gbps
vEthernet (Management)               Hyper-V Virtual Ethernet Adapter #3                      21 Up           10 Gbps
vSMB2                                Hyper-V Virtual Ethernet Adapter #2                      11 Up           10 Gbps
vSMB1                                Hyper-V Virtual Ethernet Adapter                         10 Up           10 Gbps
SLOT 1 Port 2 switch b ComputeSwitch Intel(R) Ethernet Converged Network Adapter X710          7 Up           10 Gbps
NIC4                                 Intel(R) Gigabit 4P X710/I350 rNDC                        2 Disconnected 0 bps
LordHepipud commented 3 years ago

I believe this is intentional, as the other interfaces are probably covered by the Hyper-V plugins. In case I'm not mistaken we filter our certain network devices to clear the output a little. I will have to take a closer look on this.

puseidr commented 3 years ago

for a better understanding:

"NIC1 switch a ComputeSwitch" and "SLOT 1 Port 2 switch b ComputeSwitch" are SET (Switch-Embeeed-Teaming)-Members used for Hyper-V VMs and the vNIC: "vEthernet (Management)"

"NIC2 switch b StorageSwitch " and "SLOT 1 Port 1 switch a StorageSwitch" are SET-Members used for Storage Space Direct (S2D) Replication and the vNICs: "vSMB1" and "vSMB2"

Aleksey-Maksimov commented 4 months ago

Hello.

We confirm that the plugin only shows physical interfaces, but does not show virtual interfaces that are created on the host on top of Switch Embedded Teaming (SET Switch).

PS >  Get-NetAdapter | Select Name, InterfaceDescription, ifIndex, Status, LinkSpeed | Where Status -eq Up  | Sort Name | ft

Name                                            InterfaceDescription                        ifIndex Status LinkSpeed
----                                            --------------------                        ------- ------ ---------
Hyper-V SET vNIC - Cluster - SMB Multichannel 1 Hyper-V Virtual Ethernet Adapter #2               8 Up     1 Gbps
Hyper-V SET vNIC - Cluster - SMB Multichannel 2 Hyper-V Virtual Ethernet Adapter #3               2 Up     1 Gbps
Hyper-V SET vNIC - Cluster - SMB Multichannel 3 Hyper-V Virtual Ethernet Adapter #4              14 Up     1 Gbps
Hyper-V SET vNIC - Host management              Hyper-V Virtual Ethernet Adapter                 18 Up     1 Gbps
PCIe NIC1 Port 1                                Intel(R) I350 Gigabit Network Connection #4      16 Up     1 Gbps
PCIe NIC1 Port 2                                Intel(R) I350 Gigabit Network Connection #2      12 Up     1 Gbps
PCIe NIC1 Port 3                                Intel(R) I350 Gigabit Network Connection #3       9 Up     1 Gbps
PCIe NIC1 Port 4                                Intel(R) I350 Gigabit Network Connection         24 Up     1 Gbps
PS > Invoke-IcingaCheckNetworkInterface  -Verbosity 2 -PacketReceivedDiscardedWarn 50% -PacketOutboundDiscardedWarn 50% -PackteReceivedErrorWarn 1% -PackteOutboundErrorWarn 1%
[OK] Network Device Package: 4 Ok
\_ [OK] Interface PCIe NIC1 Port 1
   \_ [OK] eth 6: AdminLocked: False
   \_ [OK] eth 6: bytes received/sec: 8.27KiB
   \_ [OK] eth 6: bytes sent/sec: 14.77KiB
   \_ [OK] eth 6: bytes total/sec: 23.04KiB
   \_ [OK] eth 6: Interface AdminStatus: Up
   \_ [OK] eth 6: Interface OperationalStatus: Up
   \_ [OK] eth 6: LinkSpeed: 1Gbit
   \_ [OK] eth 6: NetConnectionStatus: Connected
   \_ [OK] eth 6: packets outbound discarded: 0% (0c)
   \_ [OK] eth 6: packets outbound errors: 0% (0c)
   \_ [OK] eth 6: packets received discarded: 0% (0c)
   \_ [OK] eth 6: packets received errors: 0% (0c)
   \_ [OK] eth 6: packets received/sec: 61.65243c
   \_ [OK] eth 6: packets sent/sec: 15.60832c
   \_ [OK] eth 6: VlanID: 0
\_ [OK] Interface PCIe NIC1 Port 2
   \_ [OK] eth 2: AdminLocked: False
   \_ [OK] eth 2: bytes received/sec: 5.54KiB
   \_ [OK] eth 2: bytes sent/sec: 1.50KiB
   \_ [OK] eth 2: bytes total/sec: 7.04KiB
   \_ [OK] eth 2: Interface AdminStatus: Up
   \_ [OK] eth 2: Interface OperationalStatus: Up
   \_ [OK] eth 2: LinkSpeed: 1Gbit
   \_ [OK] eth 2: NetConnectionStatus: Connected
   \_ [OK] eth 2: packets outbound discarded: 0% (0c)
   \_ [OK] eth 2: packets outbound errors: 0% (0c)
   \_ [OK] eth 2: packets received discarded: 0% (0c)
   \_ [OK] eth 2: packets received errors: 0% (0c)
   \_ [OK] eth 2: packets received/sec: 54.16811c
   \_ [OK] eth 2: packets sent/sec: 5.315592c
   \_ [OK] eth 2: VlanID: 0
\_ [OK] Interface PCIe NIC1 Port 3
   \_ [OK] eth 3: AdminLocked: False
   \_ [OK] eth 3: bytes received/sec: 5.75KiB
   \_ [OK] eth 3: bytes sent/sec: 1.49KiB
   \_ [OK] eth 3: bytes total/sec: 7.24KiB
   \_ [OK] eth 3: Interface AdminStatus: Up
   \_ [OK] eth 3: Interface OperationalStatus: Up
   \_ [OK] eth 3: LinkSpeed: 1Gbit
   \_ [OK] eth 3: NetConnectionStatus: Connected
   \_ [OK] eth 3: packets outbound discarded: 0% (0c)
   \_ [OK] eth 3: packets outbound errors: 0% (0c)
   \_ [OK] eth 3: packets received discarded: 0% (0c)
   \_ [OK] eth 3: packets received errors: 0% (0c)
   \_ [OK] eth 3: packets received/sec: 54.58387c
   \_ [OK] eth 3: packets sent/sec: 4.833037c
   \_ [OK] eth 3: VlanID: 0
\_ [OK] Interface PCIe NIC1 Port 4
   \_ [OK] eth 1: AdminLocked: False
   \_ [OK] eth 1: bytes received/sec: 6.25KiB
   \_ [OK] eth 1: bytes sent/sec: 2.02KiB
   \_ [OK] eth 1: bytes total/sec: 8.26KiB
   \_ [OK] eth 1: Interface AdminStatus: Up
   \_ [OK] eth 1: Interface OperationalStatus: Up
   \_ [OK] eth 1: LinkSpeed: 1Gbit
   \_ [OK] eth 1: NetConnectionStatus: Connected
   \_ [OK] eth 1: packets outbound discarded: 0% (0c)
   \_ [OK] eth 1: packets outbound errors: 0% (0c)
   \_ [OK] eth 1: packets received discarded: 0% (0c)
   \_ [OK] eth 1: packets received errors: 0% (0c)
   \_ [OK] eth 1: packets received/sec: 55.9141c
   \_ [OK] eth 1: packets sent/sec: 6.63413c
   \_ [OK] eth 1: VlanID: 0
| 'eth6::ifw_networkinterface::packetsoutbounddiscarded'=0c;8;;0;15.60832 'eth3::ifw_networkinterface::packetsreceivedsec'=54.58387c;; 'eth3::ifw_networkinterface::packetsreceiveddiscarded'=0c;27;;0;54.58387 'eth6::ifw_networkinterface::bytestotalsec'=23593B;;;0;125000000 'eth6::ifw_networkinterface::bytesreceivedsec'=8467B;;;0;125000000 'eth6::ifw_networkinterface::packetsreceivedsec'=61.65243c;; 'eth6::ifw_networkinterface::packetssentsec'=15.60832c;; 'eth3::ifw_networkinterface::packetssentsec'=4.833037c;; 'eth6::ifw_networkinterface::linkspeed'=1000000000;; 'eth3::ifw_networkinterface::linkspeed'=1000000000;; 'eth2::ifw_networkinterface::linkspeed'=1000000000;; 'eth1::ifw_networkinterface::linkspeed'=1000000000;; 'eth6::ifw_networkinterface::packetsreceivederrors'=0c;1;;0;61.65243 'eth6::ifw_networkinterface::bytessentsec'=15125B;;;0;125000000 'eth3::ifw_networkinterface::packetsoutbounderrors'=0c;0;;0;4.833037 'eth6::ifw_networkinterface::packetsoutbounderrors'=0c;0;;0;15.60832 'eth3::ifw_networkinterface::bytestotalsec'=7416B;;;0;125000000 'eth3::ifw_networkinterface::bytessentsec'=1523B;;;0;125000000 'eth1::ifw_networkinterface::bytesreceivedsec'=6396B;;;0;125000000 'eth3::ifw_networkinterface::packetsreceivederrors'=0c;1;;0;54.58387 'eth3::ifw_networkinterface::bytesreceivedsec'=5893B;;;0;125000000 'eth1::ifw_networkinterface::bytestotalsec'=8459B;;;0;125000000 'eth1::ifw_networkinterface::packetssentsec'=6.63413c;; 'eth1::ifw_networkinterface::bytessentsec'=2064B;;;0;125000000 'eth1::ifw_networkinterface::packetsreceiveddiscarded'=0c;28;;0;55.9141 'eth3::ifw_networkinterface::packetsoutbounddiscarded'=0c;2;;0;4.833037 'eth6::ifw_networkinterface::packetsreceiveddiscarded'=0c;31;;0;61.65243 'eth1::ifw_networkinterface::packetsoutbounddiscarded'=0c;3;;0;6.63413 'eth1::ifw_networkinterface::packetsreceivederrors'=0c;1;;0;55.9141 'eth1::ifw_networkinterface::packetsoutbounderrors'=0c;0;;0;6.63413 'eth1::ifw_networkinterface::packetsreceivedsec'=55.9141c;; 'eth2::ifw_networkinterface::packetsoutbounddiscarded'=0c;3;;0;5.315592 'eth2::ifw_networkinterface::packetsoutbounderrors'=0c;0;;0;5.315592 'eth2::ifw_networkinterface::bytessentsec'=1535B;;;0;125000000 'eth2::ifw_networkinterface::packetsreceivedsec'=54.16811c;; 'eth2::ifw_networkinterface::packetsreceiveddiscarded'=0c;27;;0;54.16811 'eth2::ifw_networkinterface::packetssentsec'=5.315592c;; 'eth2::ifw_networkinterface::bytesreceivedsec'=5677B;;;0;125000000 'eth2::ifw_networkinterface::packetsreceivederrors'=0c;1;;0;54.16811 'eth2::ifw_networkinterface::bytestotalsec'=7211B;;;0;125000000
0

In our example, the "PCIe NIC1 Port ..." interfaces are the physical interfaces. They are members of SET. Based on SET, virtual interfaces "Hyper-V SET vNIC ... " were made. It is desirable that the plugins see and show statistics on virtual interfaces too.