Thermal properties of the gas in early-type galaxies and galaxy clusters