lattepanda-mu-ultra-network-monitor-i226-10.ino

LattePanda Mu Ultra: x86 Compute Module for Embedded AI · File : lattepanda-mu-ultra-network-monitor-i226-10.ino · Language : bash · Use case : Surveiller le débit réseau en temps réel sur le contrôleur Ethernet Intel I226-V à 2.5 Gbps via la commande iperf3 ou des outils système légers.

Bash script to monitor Intel I226-V Ethernet interface activity, using sar or an ip loop to display inbound and outbound traffic rates.

Check the Ethernet interface name with 'ip addr'. Install sysstat or ifstat for better visibility ('sudo apt install ifstat'). Run the script with 'chmod +x monitor_net.sh && ./monitor_net.sh'. The I226-V controller natively supports 2.5 Gbps; ensure your switch/router supports it too.

lattepanda-mu-ultra-network-monitor-i226-10.ino

#!/bin/bash
# Script de surveillance rapide de l'interface réseau Ethernet (Intel I226-V)
# LattePanda Mu Ultra - Test de bande passante et stabilité

INTERFACE="eth0" # Vérifiez le nom avec 'ip link' (pourrait être enp*s* selon la configuration)
DURATION=10     # Durée de la surveillance en secondes

# Vérification simple que l'interface existe
if ! ip link show $INTERFACE > /dev/null 2>&1; then
    echo "Interface $INTERFACE non trouvée. Vérifiez 'ip addr'."
    exit 1
fi

echo "Surveillance de $INTERFACE pendant $DURATION secondes..."
echo "-------------------------------------------------------"

# Utiliser 'sar' si sysstat est installé, sinon 'ip' en boucle simple
# Installation recommandée: sudo apt install sysstat et activer sysstat dans /etc/default/sysstat

if command -v sar &> /dev/null; then
    # Affiche les statistiques réseau par seconde (Rx/Tx kB/s)
    # sar -n DEV 1 $DURATION
    # Note: sar nécessite que sa collecteur soit actif. Pour un test rapide sans config complexe:
    echo "Utilisation de 'sar' pour les statistiques réseau..."
    sar -n DEV 1 $DURATION | grep $INTERFACE | awk '{print "Rx: " $3 " kB/s, Tx: " $4 " kB/s"}'
elif command -v ifstat &> /dev/null; then
    echo "Utilisation de 'ifstat' pour les statistiques réseau..."
    ifstat -t -i $INTERFACE $DURATION
else
    echo "Outils de monitoring avancés non trouvés. Utilisation d'une boucle 'ip' basique..."
    END_TIME=$(($(date +%s) + DURATION))
    while [ $(date +%s) -lt $END_TIME ]; do
        STATS=$(ip -s link show $INTERFACE)
        RX_BYTES=$(echo "$STATS" | grep -A 1 "RX:" | tail -n 1 | awk '{print $2}')
        TX_BYTES=$(echo "$STATS" | grep -A 1 "TX:" | tail -n 1 | awk '{print $2}')
        # Calcul simplifié (non précis pour débit instantané sans état précédent, mais utile pour debug)
        echo "$(date +%T) - RxBytes: $RX_BYTES, TxBytes: $TX_BYTES"
        sleep 1
    done
fi

echo "-------------------------------------------------------"
echo "Surveillance terminée."

← Back to the board