Intelligent monitoring to increase corrosion protection in water and wastewater plants