1

We're using Monit to check our web servers. When the check fails (or succeeds) the corresponding compontent on a status page is updated via a shell script like this:

check host web-a-https with address web-a.company.local
  if failed
    port 443
    protocol https
    request /ping.php
    content = "OK"
    with ssl options {verify: enable}
  then exec "/usr/local/sbin/statuspage/[COMPONENT]-partial"
    ELSE IF recovered THEN EXEC "/usr/local/sbin/statuspage/[COMPONENT]-up"

Now we have a situation where we want to set the compontent status to "Major Outage" if web-a-https and web-b-https BOTH are down.

I figured this might be possible with dependencies and tried this:

check program demo-group with path /bin/true
  depends on web-a-https, web-b-https
  if status == 0 then exec '/usr/local/sbin/statuspage/[COMPONENT]-up'
  if status == 1 then exec '/usr/local/sbin/statuspage/[COMPONENT]-down'

I figured that the service would only be monitored if both dependencies are up and the test (which is always true) passes. That doesn't work at all because the down events of the web-a-https, web-b-https do not seem to be propagated to the "top level".

I tried setting a start/stop command for the group service, but that doesn't work either.

Is there a way to do this in monit, or do I have to build some shell script glue to make this happen?

Phillipp
  • 492
  • 1
  • 3
  • 12

0 Answers0