In a magnetic mirror plasma experiment, the plasma containment time is often limited by the charge exchange of energetic plasma ions with thermal gas. The low-energy ions that result from the charge exchange are not trapped by the magnetic field, but emerge through the mirrors and follow the field lines with an energy of the order of the plasma potential. Mass identification of these ions helps in locating and eliminating the source of the charge-exchange gas. To perform this identification, a modified quadrupole mass spectrometer is operated in the fringe magnetic field of the Baseball II plasma experiment. From the resulting spectra an estimate is made of the density of each component of the thermal gas. For various experimental conditions of Baseball II, component density estimates and time-resolved mass analyses are given. The mass spectrometer and its operation are also described.