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: Anthony Ettinger
Subject: Re: How to use curl to check if service is down?
Date: Sun, 26 Jun 2022 02:09:51 -0700

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



On Sun, Jun 26, 2022 at 2:08 AM Lutz Mader <lutz.mader@freenet.de> wrote:
Hello Anthony,
see the way Maik suggested or see
https://mmonit.com/wiki/Monit/ConfigurationExamples#apache
for some more useful hints.

You can use "curl" in a script used in a "check program" service.
But monit can do the job also, see
https://mmonit.com/monit/documentation/monit.html#CONNECTION-TESTS

>  want to use monit and curl so that curl would hit and api and check if its
> up, if it gets a 502 or similar error then restart the systemd service.
>
> How would I do this?
>

Have a nice weekend,
Lutz



--
Anthony
408-656-2473

reply via email to

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