On (someone or something’s) last legs

Almost worn out or finished or broken, close to exhaustion or close to death.

My computer is on its last legs and soon I will have to buy a new one.