monit 5.31.0 and https/443 check failures

53 Views Asked by At

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?

1

There are 1 best solutions below

0
lutzmad On

Based on Monit 5.31.0 and 5.33.0, I can not see a problem, it works well.

Remote Host 'example-a.com'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  ping response time           -
  port response time           2.784 ms to example-a.com:8081/ type TCP/IP protocol HTTP
  port response time           0.342 ms to example-a.com:8081 type TCP/IP protocol HTTP
  data collected               Mon, 23 Oct 2023 14:00:06

Remote Host 'example-b.com'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  ping response time           -
  port response time           0.751 ms to example-b.com:8989/ type TCP/IP protocol HTTP
  port response time           0.651 ms to example-b.com:8989 type TCP/IP protocol HTTP
  data collected               Mon, 23 Oct 2023 14:00:06

But your configuration looks strange, I can not find something like this in the manual.

if failed (url https://example-a.com/ and content == '' and timeout 40 seconds) then alert

And "content == ''" should match always, I think. I use somthing like the following sometimes.

if failed port 8081 protocol http content == 'available text' with timeout 40 seconds then alert

Please, change the order of your checks, maybe failure depends to the tests order. A suggestion only.