We prove an existence and uniqueness result for solutions φ to a weighted pendulum equation in R where the weight is non-smooth and coercive. We also establish (in)stability results for φ according to the monotonicity of the weight. These results are applied in a reduced model for thin ferromagnetic nanowires with notches to obtain existence, uniqueness and stability of domain walls connecting two opposite directions of the magnetization.