I have two Wordpress sites on the same server. Both use LetsEncrypt. One fails constantly, the other succeeds. I'm not sure why!
check host example-a.com with address www.example-a.com
if failed icmp type echo count 5 with timeout 150 seconds then alert
if failed port 443 protocol https with timeout 150 seconds then alert
if failed (url https://example-a.com/ and content == '' and timeout 40 seconds) then alert
check host example-b.com with address www.example-b.com
if failed icmp type echo count 5 with timeout 150 seconds then alert
if failed port 443 protocol https with timeout 150 seconds then alert
if failed (url https://example-b.com/ and content == '' and timeout 40 seconds) then alert
Checking monit status:
Remote Host 'example-a.com'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
ping response time 0.020 ms
port response time 193.949 ms to example-a.com:443/ type TCP/IP using TLS (certificate valid for 67 days) protocol HTTP
port response time 5.823 ms to www.example-a.com:443 type TCP/IP using TLS (certificate valid for 67 days) protocol HTTP
data collected Fri, 13 Oct 2023 14:39:44
Remote Host 'example-b.com'
status Connection failed
monitoring status Monitored
monitoring mode active
on reboot start
ping response time 0.016 ms
port response time FAILED to [example-b.com]:443/ type TCP/IP using TLS protocol HTTP
port response time 935.562 ms to www.example-b.com:443 type TCP/IP using TLS (certificate valid for 57 days) protocol HTTP
data collected Fri, 13 Oct 2023 14:39:46
Because one check works, I would assume it's not a monit issue. But what else would it be?
Based on Monit 5.31.0 and 5.33.0, I can not see a problem, it works well.
But your configuration looks strange, I can not find something like this in the manual.
And "content == ''" should match always, I think. I use somthing like the following sometimes.
Please, change the order of your checks, maybe failure depends to the tests order. A suggestion only.