Despite the recent increase in smart farming practices, system uncertainty and difficulties associated with maintaining farming sites hinder their widespread adoption. Agricultural production systems are extremely sensitive to operational downtime caused by malfunctions because it can damage crops. To resolve this problem, the types of abnormal data, the present error determination techniques for each data type, and the accuracy of anomaly data determination based on spatial understanding of the sensed values are classified in this paper. We design and implement a system to detect and predict abnormal data using a recurrent neural network algorithm and diagnose malfunctions using an ontological technique. The proposed system comprises the cloud in charge of the IoT equipment installed in the farm testbed, communication and control, system management, and a common framework based on machine learning and deep learning for fault diagnosis. It exhibits excellent prediction performance, with a root mean square error of 0.073 for the long short-term memory model. Considering the increasing number of agricultural production facilities in recent years, the results of this study are expected to prevent damage to farms due to downtime caused by mistakes, faults, and aging.