我们正在使用Monit来检查我们的Web服务器。 当检查失败(或成功)时,状态页面上相应的组件将通过如下的shell脚本更新:
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"
现在我们有一个情况,如果web-a-https和web-b-https BOTHclosures,我们想把组件的状态设置为“重大中断”。
我想这可能是依赖的可能性,并试图这样做:
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'
我发现如果两个依赖关系都启动并且testing(通常是真的)通过,那么服务只能被监视。 这根本不起作用,因为web-a-https,web-b-https的down事件似乎没有被传播到“顶层”。
我尝试设置组服务的开始/停止命令,但这也不起作用。
有没有办法做到这一点monit,或者我必须build立一些shell脚本胶水,使之发生?