Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etcdctl endpoint health -w json does not output in JSON #9532

Closed
omkensey opened this issue Apr 5, 2018 · 2 comments
Closed

etcdctl endpoint health -w json does not output in JSON #9532

omkensey opened this issue Apr 5, 2018 · 2 comments
Labels

Comments

@omkensey
Copy link

omkensey commented Apr 5, 2018

The health subcommands of etcdctl do not output in JSON even when JSON is explicitly requested:

$ ETCDCTL_API=3 etcdctl endpoint health -w json
http://127.0.0.1:10001 is healthy: successfully committed proposal: took = 668.335µs
$ ETCDCTL_API=3 etcdctl endpoint --cluster health -w json
http://127.0.0.1:20001 is healthy: successfully committed proposal: took = 601.324µs
http://127.0.0.1:20003 is healthy: successfully committed proposal: took = 804.816µs
http://127.0.0.1:20002 is unhealthy: failed to connect: dial tcp 127.0.0.1:20002: connect: connection refused
Error: unhealthy cluster

Something like this would work:

{
  "cluster": {
    "health": {
      "healthy": "false"
    },
    "peers": [
      {
        "Endpoint": "http://127.0.0.1:20003",
        "health": {
          "healthy": "true",
          "reason": "successfully committed proposal: took = 804.816µs"
        }
      },
      {
        "Endpoint": "http://127.0.0.1:20001",
        "health": {
          "healthy": "true",
          "reason": "successfully committed proposal: took = 601.324µs"
        }
      },
      {
        "Endpoint": "http://127.0.0.1:20002",
        "health": {
          "healthy": "false",
          "reason": "failed to connect: dial tcp 127.0.0.1:20002: connect: connection refused"
        }
      }
    ]
  }
}
@gyuho
Copy link
Contributor

gyuho commented Apr 6, 2018

Oh was confused with below issue.
Yeah, this should not happen. Will fix.

Thanks for report!

@marc-swingler
Copy link

marc-swingler commented Nov 5, 2018

Will the fix get backported to v3.3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants