We extend the technique originally proposed by [Honda et al., Phys. Rev. A 59, R934 (1999)] to measure the temperature of ytterbium and alkaline-earth-metal atoms confined in a magneto-optical trap (MOT). The method is based on the analysis of excitation spectra obtained by probing the ${}^{1}{\text{S}}_{0}\ensuremath{\rightarrow}{}^{3}{\text{P}}_{1}$ intercombination line. Thanks to a careful analysis and modeling of the effects caused by the MOT light on the probe transition we overcome the resolution and precision limits encountered in previous works. Ground-state light shift and Rabi broadening are measured and successfully compared with calculated values. This knowledge allows us to properly extract the Doppler contribution to the linewidth, thus obtaining a reliable measurement of the cloud temperature. We finally show how spectroscopy on free-falling atoms provides an alternative method to determine the sample temperature which resembles the standard time-of-flight technique.