The Ping test seems to only use the first seen IP address. If there is a failure on an AAAA Record, the A Record will not be checked.
Changelog (and documentation) states:
From Changelog, 5.12.1:
New: [...] If a host name is used [...], Monit will try to connect to the first available address (be it IPv4 or IPv6). If the connection fails, Monit will try the next address and so on until a connection succeed or until there are no more addresses left to try. [...]
I created a test domain with a IPv6 that will not respond, but additionally with an IPv4 address that responds. You'll find it at
fail6.boppy.eu - feel free to use this domain for testing proposes.
Will not work (but should):
check host IPv6Fail with address fail6.boppy.eu if failed ping then alert
check host IPv6Fail with address fail6.boppy.eu if failed ping4 then alert
If testing on bash it works out "fine", saying
ping -4 -c2 fail6.boppy.eu is responding while
ping -6 -c2 fail6.boppy.eu is not.