Hello I am Dr. Joey. Thanks for trusting me to help you and your pet today. I am a licensed veterinarian with over 16 years of experience. I look forward to working with you.
Based on what you have written, it sounds like your dog may be experiencing diarrhea (this is much more common than constipation to cause the straining), which may have led to him feeling dehydrated. Or, he is having pain in the hind end leading to straining of another problem such as anal sac infection/pain. Whatever the underlying cause, especially if he has diarrhea, may be sapping his energy.
I wish I could give you an exact diagnosis for his issues but his symptoms are vague and could reflect many different issues ranging from ingestion of unusual item that upset his digestive tract (or may be trapped in his system) to organ problem (liver, kidney) to pancreatitis to endocrine disease to parasitism and the list continues.
Given that he is not eating and seems painful (tough to go up steps), I must recommend you have him seen by his veterinarian as soon as possible today for an examination followed by some testing which might include lab work (CBC, chemistry profile, urine check and stool check) +/- radiographs (X-rays).
If you are unable to have him seen and you confirm this is diarrhea then I can give you some hints to try at home.