Magnetic moment formation in metal-organic monolayers