Fix monitoring script (issue #3809)