Pneumonia is an infection of the lungs, usually caused by viruses or bacteria. A person with pneumonia may have a fever and cough, and it may be hard to breathe for a little while. A doctor can tell you have pneumonia by listening to your lungs or looking at a chest X-ray. Pneumonia can be serious, so sometimes a person who has pneumonia has to go to the hospital. But in most cases, a doctor can treat pneumonia while a person gets better at home.