Magnetism of Nanostructures on Metallic Substrates