Thread
#prefect-community
    Constantino Schillebeeckx

    Constantino Schillebeeckx

    7 months ago
    is there some sort of API endpoint that we can hit which serves as a health check? I'm wondering how I can programmatically check that the agent is healthy
    Michael Adkins

    Michael Adkins

    7 months ago
    Yep! The agent hosts a healthcheck API
    Anna Geller

    Anna Geller

    7 months ago
    @Marvin archive “How can I programmatically check whether Prefect agent is healthy?”
    Marvin

    Marvin

    7 months ago
    Constantino Schillebeeckx

    Constantino Schillebeeckx

    7 months ago
    very cool 🙂
    Michael Adkins

    Michael Adkins

    7 months ago
    Note you can also provide the address via the CLI with
    --agent-address TEXT
    Constantino Schillebeeckx

    Constantino Schillebeeckx

    7 months ago
    Could you give some hints on what the address might be? We have an ECS agent running as a Fargate task.
    Michael Adkins

    Michael Adkins

    7 months ago
    The address is empty by default
    You’ll need to set the environment variable for the config or change the command the task runs. e.g.
    prefect agent local start --agent-address <http://0.0.0.0:5000/>
    ❯ curl <http://localhost:5000/api/health>
    {}%
    Constantino Schillebeeckx

    Constantino Schillebeeckx

    7 months ago
    That makes sense for the local case; but when my agent is hosted on ECS (as a Fargate task) I imagine I can't just set the address to anything?
    Michael Adkins

    Michael Adkins

    7 months ago
    0.0.0.0 binds to all incoming connections so you could then perform a healthcheck at whatever the IP of your task is
    That’d be determined by AWS networking, which I can’t help you with 🙂 in that case, you can check the agent’s last query time by hitting the server’s GraphqQL API instead
    e.g.
    <https://cloud.prefect.io/api?query={%0Aagent{%0A%20> id%0A%20 last_queried%0A}}
    Constantino Schillebeeckx

    Constantino Schillebeeckx

    7 months ago
    Even easier! Thanks so much