Hi Joy,
The age of 17 sure is a great number of years for Spike to be with you. First off, I would recommend an exam with your veterinarian. A cough could be due to a number of issues involving the heart. Some dogs get a fibrosis of the lungs as they age and that prevents normal expansion of the airways, something like this may be worsened with varying temperature and humidity levels such as those changes which occur at night. With any older pet, we also want to rule out cancer and kidney disease, among other chronic diseases.
I hope this helps,
Dr. Ryan Llera