IoT-enabled Smart Monitoring and Optimization for Industry 4.0