high-speed-eth-pdu-2.ino

BIOSSTAR BIWCL-PAT: 3.5" Industrial SBC with Intel Wildcat Lake · File : high-speed-eth-pdu-2.ino · Language : python · Use case : Surveillance en temps réel du trafic réseau sur les deux interfaces Ethernet 2.5GbE Intel i226-LM.

Python script using psutil to monitor 2.5GbE Ethernet port activity.

Uses 'psutil' (install via pip) to query network I/O counters. BIWCL-PAT cards use Intel i226-LM controllers; verify interface names with 'ip link'. Useful for edge computing QoS troubleshooting.

high-speed-eth-pdu-2.ino

import psutil
import time

# Identification des interfaces réseau (Intel i226-LM apparaît souvent comme eth0/eth1 ou enp*0*
# Utiliser 'ip addr' pour confirmer les noms exacts sur le système cible)
INTERFACES = ['eth0', 'eth1'] 

print(f"Surveillance des interfaces : {INTERFACES}")
print("Appuyez sur Ctrl+C pour arrêter...")

try:
    while True:
        counters = psutil.net_io_counters(pernic=True)
        for iface in INTERFACES:
            if iface in counters:
                data = counters[iface]
                # Calcul des débits approximatifs (simplifié pour l'exemple)
                # Pour une précision industrielle, utiliser des timers haute résolution
                mb_sent = (data.bytes_sent / (1024 * 1024))
                mb_recv = (data.bytes_recv / (1024 * 1024))
                print(f"[{iface}] Envoyé: {mb_sent:.2f} MB | Reçu: {mb_recv:.2f} MB")
            else:
                print(f"Interface {iface} non trouvée ou inactive.")
        print("-" * 40)
        time.sleep(1)
except KeyboardInterrupt:
    print("\nSurveillance arrêtée.")

← Back to the board