The expression ON ONE’S LAST LEGS means very close to failure, exhaustion, or death:
Our team was on its last legs and nobody was expecting the victory.
I was on my last legs when I got home after work and I went to bed right away.
The dog is on his last legs. He’s 17 years old after all.
You should get a new computer. This one seems to be on its last legs.
Short before the revolution everybody could feel in the air that the monarchy was on its last legs.
Here’s the video version of the article: