node-consul icon indicating copy to clipboard operation
node-consul copied to clipboard

There's no easy, or any, way of check if consul is actually up and running

Open JJ opened this issue 5 years ago • 4 comments

I haven't found it. I'd simply would like to check, using this library, if consul daemon is running, or do something else instead if it's not.

JJ avatar Jan 27 '21 10:01 JJ

Hi @JJ you could retry, if you get an http error. After some tries you can kill your service and let the environment deal with that state.

sSeewald avatar Jul 05 '21 10:07 sSeewald

That's not easy, and it's not an "official" way of doing it. I was looking for something along the lines of the status subcommand that some services (if not most) have.

JJ avatar Jul 05 '21 10:07 JJ

The last time I looked consul didn't have a dedicated health endpoint (for the agent).

I consider the scope of this library to be about the same as the Go API client. If that client has method that does what you want I'd look into implementing it.

silas avatar Jul 05 '21 12:07 silas

There's /v1/status/host that has a great deal of data, perhaps too much. Perhaps the same for /v1/agent/self. I wonder how much information /v1/status/leader reveals about the cluster.

You'll know if the agent is up. If your agent isn't part of the cluster, what do you get back from leader?

jdmarshall avatar Feb 24 '22 23:02 jdmarshall