One thing I'm not sure about is how monit knows which systemd service to
restart. I haven't specified it anywhere.

On Sun, Jun 26, 2022 at 11:15 PM Lutz Mader <[email protected]> wrote:

> Hello Anthony,
> as long as you are sure the http status is 200, you can use this.
>
> > This is what I have now, but I don't know if its correct:
> >
> > check host grazily.com with address grazily.com
> >         start program = "/bin/systemctl start grazily-api"
> >         stop program = "/bin/systemctl stop grazily-api"
> >
> >         if failed
> >                 port 443 protocol http and request "/api/1" method GET
> > status != 200
> >         then restart
>
> Unfortunately, in general you will get some other status codes too, but
> this depends to your application.
> I use an addition "... with timeout 30 seconds retry 5 then" to prevent
> restart problems. And for "ssl" connections you can use "... and
> certificate valid > 30 days ..." too.
>
> if failed
>    port 443 protocol http and request "/api/1" method GET
>    status != 200
>    with timeout 30 seconds retry 5
>    then restart
>
> See https://mmonit.com/monit/documentation/monit.html#HTTP
>
> With regards,
> Lutz
>
>

-- 
Anthony
408-656-2473

Reply via email to