There could be a few things going on. It sounds like he might be experiencing some anxiety. You state that he has had anal gland issues in the past so he might associate the smell of a leaky anal gland with pain. It's kind of like people who have gall bladder disease (or another condition). They can feel the triggers (heartburn, etc) and this causes them to sweat and get a little frantic because they know that pain is coming.
I would suggest that you use a homeopathic anxiety medication that we have used with a lot of success. It's called homeopet (www.homeopet.com) and you can get it at most petsmarts.
And be sure to keep an eye on his anal gland health. He sounds like one who will need to have them expressed more than the average dog.
Let me know if you still have questions.