The use of resonant inelastic X-ray scattering (RIXS) to understand local environment around magnetic atoms in various diluted magnetic semiconductors (DMS) and dielectrics (DMD) has been overviewed. The overall spectroscopic results of transition-metal-doped GaAs DMS and wide band-gap oxide DMD systems show that the magnetic transition-metal dopants can occupy not only cation sites but also interstitial ones and the interactions between substituted and interstitial magnetic ions play a very important role on the nature of magnetic properties of these materials. This suggests that a careful verification of presence/absence of structural defects is required, especially for when the size of defect configuration is very small (less than few nm).