【问题标题】:When will monit actually start or restart a servicemonit 何时实际启动或重新启动服务
【发布时间】:2021-06-09 03:48:10
【问题描述】:

有人可以告诉我 monit 是根据什么决定重启应用程序的吗?例如,如果我想让 monit 监控我的 Web 应用程序,我应该向 monit 提供哪些信息,然后它将根据这些信息重新启动?

谢谢

更新: 我能够使用以下监视器配置使其工作

check host altamides with address web.dev1.ams
if failed port 80 with protocol http
      then alert

但是,我想知道是否可以使用我的应用程序的任何绝对 URL。类似http://foo:5453/test/url/1.html/

有人可以帮我吗?

【问题讨论】:

    标签: monit application-monitoring


    【解决方案1】:

    Monit 自己不会重启任何服务,但是你可以给它提供你想要执行它的规则,你可以做类似的事情

    check process couchdb with pidfile /usr/local/var/run/couchdb/couchdb.pid
        start program = "/etc/init.d/couchdb start"
        stop program  = "/etc/init.d/couchdb stop"
        if cpu > 60% for 2 cycles then alert
        if cpu > 80% for 5 cycles then restart
        if memory usage > 70% MB for 5 cycles then restart
    
    
    check host mmonit.com with address mmonit.com
          if failed port 80 protocol http then alert
          if failed port 443 protocol https then alert
    

    【讨论】:

    • 谢谢。我想知道是否有一项规定,我可以传递我的 Web 应用程序的一些 URL,monit 可以定期检查 HTTP 200。如果它没有得到 200 然后重新启动应用程序。这可以使用monit吗?
    • 当然可以,我建议你去monit的网站获取更多示例,我在原始答案中添加了一个sn-p
    【解决方案2】:

    我从 monit 帮助页面找到了答案

     if failed
        port 80
        protocol http
        request "/data/show?a=b&c=d"
     then restart
    

    【讨论】:

      猜你喜欢
      • 2022-11-30
      • 1970-01-01
      • 2016-01-03
      • 1970-01-01
      • 2019-08-23
      • 2011-04-21
      • 2019-03-03
      • 2015-10-28
      相关资源
      最近更新 更多