X-ray observations of hot gas in early-type galaxies and groups of galaxies