Diagnose PoE budget and an optic by its numbers
Task
Turn two "faulty hardware" complaints into arithmetic. A PoE switch that stops powering new devices and a fibre link that will not come up are both diagnosable from numbers the device reports — the power budget and the optic's transmit and receive levels. You will write a small parser that reaches the verdict, because the interpretation is the examinable skill.
Steps
- Capture the PoE picture as you would read it from
show power: the switch's total budget and the draw of each powered port. Put them in a file, oneport,wattsline per device plus abudget,<watts>line. - Write the budget check: sum the draws, subtract from the budget, and report whether the next device — an 802.3at camera needing 30 W at the port — can be powered. This is the "devices that worked yesterday stop powering on" fault reduced to a subtraction.
- Capture the optic figures as
ethtool -mreports them on real hardware: the measured transmit power, the measured receive power, and the receiver sensitivity threshold in dBm. - Write the classifier for the four cases from the lesson: nothing transmitted means the local optic failed; transmitted but nothing received means the fibre path is broken or the strands are crossed; received power below the sensitivity threshold means too much loss; received power above the maximum means the optic is overdriven and needs an attenuator.
- Run both checks and read the verdicts. The point is that "faulty camera" and "faulty fibre" became specific, testable classifications.
Verify
python3 poe_budget.py power.txt; echo "budget verdict exit $?"
python3 optic_class.py optic.txt
grep -E "^budget|^port" power.txt | wc -l
The parser's printed verdict — "220 W drawn of 370 W, next 30 W device OK" or "receive −28 dBm below −24 dBm threshold: excessive loss" — is the deliverable. It settles the question the way the switch's own numbers do: the fault is named from measurement, not guessed from which component is easiest to blame.
Notes
The lesson underneath both checks is measure before you replace. Signal strength is what distinguishes a transceiver fault from a fibre fault: the same "link down" symptom resolves to a dead local optic, a broken path, excessive loss or an overdriven receiver depending on the two dBm readings, and each has a different fix — replace the optic, chase the fibre, clean the connectors, or fit an attenuator.
The PoE budget fault is the one people misdiagnose most, because the symptoms are indirect: devices that boot and then reset (they draw more once their radios start than at boot), or a new device that refuses to power while everything else is fine. The switch logs a power-budget message nobody reads because they are staring at the device. Also check the standard — an 802.3bt camera on an 802.3af switch will not get the power it needs, and that too looks like a faulty camera.