Device for inspecting a machine with a sample which is inserted through an opening in the machine