简体   繁体   中英

When will monit actually start or restart a service

Can someone please let me know on what basis monit decides that its time to restart an application? For instance, if I want monit to monitor my web application, what information should I provide to monit based on which it will restart?

thanks

Update: I was able to kind of make it work using the following monit config

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

However, I was wondering if I can use any absolute URL of my application. Something like http://foo:5453/test/url/1.html/

Can someone help me on that please?

Monit by himself will not restart any service, but you can provide to it the rules you want to perform it, you can do something like

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

I figured the answer from monit help page

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM