Last legs
To be on one’s last legs is to be very near to exhaustion, usefulness or even death. The expression dates from the late 16th century.