The police have arrested eight suspects with links to Islamic State (IS) and foiled threats against the Yang di-Pertuan Agong and the Prime Minister.