Moths are the main enemy of wool rugs since moths are fed on sheep wools. There are several stages of moth "invasion"
First of all we should know that rugs laid on the floor never gets attacked by moths as long as it is being used and being stepped. The problem starts when the rug is not used and packed into the storage. To avoid moths the best way is to get the rug out of the storage once every each month, have it layered on the floor or a surface in an airy room, you may do it more often in summer since moths are much more active on hot weather. Wiping the rug with vinegar once in every 6 months would be very useful as well, it will also keep the rug shiny and healty. Vinegar is the best friend of a rug. In case if you don't have chance to get the rug breath for a long time and it has to be packed in the storage then there is another way of avoiding the moths; wrap it with newspapers in and out, it is not a scientifically proven way but somehow it seems to be working, it is may be the ink on the newspapers or the smell of the paper that keeps them away. These are the things to avoid rug invasion. Then there are things to do after the rug is being invaded by moths. We can roughly divide the invasion in three stages.
1. First stage: moths slowly scouting the rug and looking for the best spot to lay its eggs, if you see the moths flying around your rug at this stage, check your rug carefully and see if it had eaten any part of the rug and lay the rug on the ground immediately and have it breath, a vinegar treatment would also be a good idea
2. Second Stage: If you see the moths settled down on your rug then they have probably laid their eggs on the rug, you can see the tiny laid eggs if you tap on the rug slowly. at this stage there is nothing you can do personally, just call your professional rug cleaner as soon as possible and have your rug washed, do not forget to mention the cleaner about the eggs so that they can wash the rug with special care. At this stage you are still lucky your rug is not eaten yet and it is saved.
3. Third Stage: At this stage the moths settled down on the rug, laid their eggs and grown into larva state, larvas move around and excrete their sticky secretion on the rug and eats the rug with the grown moths. They may be damaged many parts of the rug, they first eat the wefts then warps. If you see your rug in this situation, again you don't have anything to do by yourself, call your rug cleaner and have your rug washed immediately, some eaten parts may fall of during washing process since they are really weakened.
I personally do not recommend you to use any chemicals that claims to kill or avoid moths. With my experience for years i can say that none of them worksas they claim, at least i didn't see any that works so far.