monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use curl to check if service is down?


From: Lutz Mader
Subject: Re: How to use curl to check if service is down?
Date: Mon, 27 Jun 2022 08:14:25 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

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

[Prev in Thread] Current Thread [Next in Thread]