Monitoring script with trivial flap detection