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

Reply via email to