Insect or virus? How plants know

Most plants have plenty of enemies, from insects and other grazing creatures to various diseases, droughts and many other stressors.