Wikipedia
In 1938, the Austrian ethologist Karl von Frisch made his first report on the existence of the chemical alarm signal known as Schreckstoff (startle/shock matter) in minnows. An alarm signal is a response produced by an individual, the “sender”, reacting to a hazard that warns other animals, the receivers, of danger. This chemical alarm signal is only released when the sender incurs mechanical damage, such as when it has been caught by a predator, and is detected by the olfactory system. When this signal reaches the receivers, they perceive a greater predation risk and exhibit an antipredator response. Since populations of fish exhibiting this trait survive more successfully, the trait is maintained via natural selection. While the evolution of this signal was once a topic of great debate, recent evidence suggests schreckstoff evolved as a defense against environmental stressors such as pathogens, parasites, and UVB radiation and that it was later co-opted by predators and prey as a chemical signal.