Cavity optomechanical magnetometry