There’s an article in malaysia-today about how monkeys get angry and attacking, what trigger them, and what are the signs. If you’re going to visit Monkey Forest in Ubud, there’s also a small excerpt.
According to one study, about three-quarters of all the aggressive interactions between long-tailed macaques and tourists at Bali’s Padangtegal Monkey Forest involved food. If you are holding a snack, throw it in their direction, and they’ll stop bothering you. If you don’t have any food, hold out your open palms to show you’re not carrying a tasty treat or back away from the monkeys without showing fear. To diffuse the situation, don’t make eye contact or smile with your teeth showing - in the nonhuman primate world, these are almost always signs of aggression.
The Article.