gigabit_eth_poe_monitor-7.ino
Python script verifying Gigabit Ethernet link speed and querying PoE support status on the BCM54210PE port.
The example assumes the network interface is 'eth0'. For precise PoE monitoring, a tool specific to the BCM54210PE controller might be required beyond standard ethtool. Ensure the cable is connected and PoE power is active on the switch or injector. Reading /sys/class/net/eth0/speed requires the link to be established.
gigabit_eth_poe_monitor-7.ino
import subprocess
import sys
def check_poe_status():
"""Vérifie l'état de l'alimentation PoE via le contrôleur BCM54210PE
Note : Accès direct aux registres PoE peut nécessiter un outil spécifique (ex: poe-tool)
"""
try:
# Simulation de lecture de l'état PoE (à adapter selon le driver installé)
result = subprocess.run(['sudo', 'ethtool', '-p', 'eth0'], capture_output=True, text=True)
if 'Support PoE:' in result.stdout:
print("PoE support détecté sur eth0")
else:
print("Statut PoE non disponible via ethtool standard.")
except Exception as e:
print(f"Erreur lecture PoE: {e}")
def check_link_speed():
"""Vérifie la vitesse de liaison Ethernet"""
try:
with open('/sys/class/net/eth0/speed', 'r') as f:
speed = f.read().strip()
print(f"Vitesse de liaison Ethernet : {speed} Mbps")
except IOError:
print("Impossible de lire la vitesse de liaison.")
if __name__ == "__main__":
print("--- Surveillance Réseau Xerxes Pi ---")
check_link_speed()
check_poe_status()