Improve monitoring e2e test.

Fixes #3054.