  Context. Some circumstellar-interacting (CSI) supernovae (SNe) are produced
by the explosions of massive stars that have lost mass shortly before the SN
explosion. There is evidence that the precursors of some SNe IIn were luminous
blue variable (LBV) stars. For a small number of CSI SNe, outbursts have been
observed before the SN explosion. Eruptive events of massive stars are named as
SN impostors (SN IMs) and whether they herald a forthcoming SN or not is still
unclear. The large variety of observational properties of CSI SNe suggests the
existence of other progenitors, such as red supergiant (RSG) stars with
superwinds. Furthermore, the role of metallicity in the mass loss of CSI SN
progenitors is still largely unexplored. Aims. Our goal is to gain insight on
the nature of the progenitor stars of CSI SNe by studying their environments,
in particular the metallicity at their locations. Methods. We obtain
metallicity measurements at the location of 60 transients (including SNe IIn,
SNe Ibn, and SN IMs), via emission-line diagnostic on optical spectra obtained
at the Nordic Optical Telescope and through public archives. Metallicity values
from the literature complement our sample. We compare the metallicity
distributions among the different CSI SN subtypes and to those of other
core-collapse SN types. We also search for possible correlations between
metallicity and CSI SN observational properties. Results. We find that SN IMs
tend to occur in environments with lower metallicity than those of SNe IIn.
Among SNe IIn, SN IIn-L(1998S-like) SNe show higher metallicities, similar to
those of SNe IIL/P, whereas long-lasting SNe IIn (1988Z-like) show lower
metallicities, similar to those of SN IMs. The metallicity distribution of SNe
IIn can be reproduced by combining the metallicity distributions of SN IMs
(that may be produced by major outbursts of massive stars like LBVs) and SNe
IIP (produced by RSGs). The same applies to the distributions of the Normalized
Cumulative Rank (NCR) values, which quantifies the SN association to H II
regions. For SNe IIn, we find larger mass-loss rates and higher CSM velocities
at higher metallicities. The luminosity increment in the optical bands during
SN IM outbursts tend to be larger at higher metallicity, whereas the SN IM
quiescent optical luminosities tend to be lower. Conclusions. The difference in
metallicity between SNe IIn and SN IMs suggests that LBVs are only one of the
progenitor channels for SNe IIn, with 1988Z-like and 1998S-like SNe possibly
arising from LBVs and RSGs, respectively. Finally, even though linedriven winds
likely do not primarily drive the late mass-loss of CSI SN progenitors,
metallicity has some impact on the observational properties of these
transients. Key words. supernovae: general - stars: evolution - galaxies:
abundances
