3

I've got a monit setup to http check several subdomains of an http server.

Currently, they are multiple check host statements that look like this:

CHECK HOST a.example.com with address 1.2.3.4
 if failed url https://blah then alert
CHECK HOST b.example.com with address 1.2.3.4
 if failed url https://blah then alert

It's possible for either the entire server to be in a failed state, or for any subdomain.

In instances where the entire server is down, or if we've lost a load balancer, I would like not to receive notifications for a dozen individual subdomains.

Can a single failed test disable a subsequent test? Is it possible to group all of these URLs under a single HOST section and combine them in an OR ?

0

1 Answer 1

0

Can a single failed test disable a subsequent test?

To my knowledge, this is not possible with Monit.

Is it possible to group all of these URLs under a single HOST section and combine them in an OR ?

Yes, you can simply add as many if rules as you can (or your HDD will store ;-)). Since every if is a rule by its own, it automagically acts as OR connected.

I always link them to my httpd process like so:

check process "nginx" with pidfile /var/run/nginx.pid
    start   program = "/bin/systemctl start   nginx.service"
    restart program = "/bin/systemctl restart nginx.service"
    stop    program = "/bin/systemctl stop    nginx.service"

    if failed
        host glances.boppy.eu
        port 443
        protocol https
        request "/.well-known/nitmo-ping.txt"
        with ssl options {verify: enable}
        ssl certificate valid 5 days
    then alert

So it's not only checking availability of the domain/path/file, it also informs me if my silly cronjob to renew the certificates didn't do its job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .