Under monit 5.11, the following test works:
if failed host localhost port 161 type udp then restart
Under monit 5.12, it generates a "Connection failed" in monit summary.
Changing it to:
if failed host 127.0.0.1 port 161 type udp then restart
works as expected.
/etc/hosts has standard declaration for 127.0.0.1 localhost.