Industry 4.0 leverages on cyber-physical systems (CPSs) that enable different physical sensors, actuators, and controllers to be interconnected via switches and cloud computing servers, forming complex online systems. Protecting these against advanced cyber threats is a primary concern for future application. Cyberattackers can impair such systems by producing different types of cyber threats, ranging from network attacks to CPS controller attacks, which could impose catastrophic damage to CPS infrastructure, companies, governments, and even the general public. This paper proposes a learned monitor, analyze, plan, execute, and knowledge (MAPE-K) base model as a method for supporting self-adaptation for the CPSs, ensuring reliability, flexibility, and protection against cyber threats. The model aims to gauge normal behavior in an industry environment and generate alarms to alert users to any abnormalities or threats. In turn, our evaluation shows 99.55% accuracy in detecting cyber threats.