Pneumonia is an inflammatory condition of the lung affecting primarily the microscopic air sacs known as alveoli. It is caused by infection with viruses or bacteria and less commonly by other microorganisms, certain medications and conditions such as autoimmune diseases.