This is an example of a metaphor. A metaphor is often an exaggeration, and it is used in a way that cannot be taken literally.
In this case, it is a metaphor to describe the students' erratic behavior. It cannot be taken literally, because the students are not real monkeys. It is simply used to emphasize on the way that the students are acting.