Random Inspections and Periodic Reviews: Optimal Dynamic Monitoring