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

Export health check definition via the API #1680

Open
mmoya opened this issue Feb 3, 2016 · 10 comments
Open

Export health check definition via the API #1680

mmoya opened this issue Feb 3, 2016 · 10 comments
Labels
theme/health-checks Health Check functionality type/enhancement Proposed improvement or new feature

Comments

@mmoya
Copy link

mmoya commented Feb 3, 2016

Right now you can know the state of a health check but not what is the health check itself, ie: the provided script/http line when registering it.

@slackpad slackpad added the type/enhancement Proposed improvement or new feature label Feb 13, 2016
@CpuID
Copy link

CpuID commented Jun 14, 2016

@slackpad discussed this earlier today with you - no need to create a duplicate... :)

Need to determine what the HealthCheck type needs to look like, to augment it to expose the actual checks.

There were thoughts regarding future use of HCL from @sethvargo - and structuring the Go type/s to future proof it.

An initial brainstorm of a response JSON body would be something like:

[
  {
    "Node": "foobar",
    "CheckID": "service:redis",
    "Name": "Service 'redis' check",
    "Check": {
      "Type": "(Script|HTTP|TCP|TTL)",
      "Script": {
        "insertsomefieldshere": "true"
      },
      "HTTP": {
        "URL": "http://foobar:5000/health",
        "Interval": "10s",
        "Timeout": "1s"
      },
      "TCP": {
        "HostAndPort": "localhost:22",
        "Interval": "10s",
        "Timeout": "1s"
      },
      "TTL": {
        "insertsomefieldshere": "true"
      }
    },
    "Status": "passing",
    "Notes": "",
    "Output": "HTTP GET http://localhost:5000/health Output: \"healthy\"",
    "ServiceID": "redis",
    "ServiceName": "redis"
  }
]

Not super well thought out and I'm almost certain it will need to be tweaked, but something to start iterating against.

Related types:

Things to consider:

  • Expanding the single string key TCP and HTTP in each of the above types respectively to be pieces of a URI, or Hostname and Port separately. For example HTTP would become Scheme, Hostname, Port, URI. TCP would become Hostname and Port.

@CpuID
Copy link

CpuID commented Jun 14, 2016

Once the internal structure of the types is finalised, I can look at starting a PR for this.

@CpuID
Copy link

CpuID commented Nov 16, 2016

@slackpad bump :)

@slackpad slackpad added this to the 0.7.3 milestone Nov 16, 2016
@slackpad
Copy link
Contributor

Sorry for the delay on this! I'll pin this to an upcoming release so we can slot a little time for it.

@CpuID
Copy link

CpuID commented Nov 16, 2016

@slackpad great thx ;)

@slackpad slackpad modified the milestones: 0.7.4, 0.7.3 Jan 17, 2017
@CpuID
Copy link

CpuID commented Feb 8, 2017

@slackpad bump, I noticed it missed 0.7.3/0.7.4 :)

@slackpad slackpad removed this from the Triaged milestone Apr 18, 2017
@slackpad slackpad added the theme/health-checks Health Check functionality label May 25, 2017
@ifuyivara
Copy link

Any updates on this? I'll be happy to take a look if no progress has been made yet

@CpuID
Copy link

CpuID commented Nov 16, 2017

+1 to getting some movement on this one.

@crhino
Copy link
Contributor

crhino commented Nov 12, 2019

Useful context in #623 (comment), pointing out that some endpoints have a buggy/incomplete implementation of this.

@maxiloEmmmm
Copy link

maxiloEmmmm commented Aug 19, 2020

好了么。。。。Definition空的 /v1/agent/checks
image

我现在尝试

  1. RegExp 匹配 Output
  2. 分析得到hostport

或者

  1. 后端生成config.json
  2. 使用ansible playbook task部署到consul agent data-dir
  3. consul reload
  4. 扫描consul agent data-dir获取配置

还有什么好方法?


最后措施

  1. 设置Definition->Notes
  2. parse Notes

结束 剩下的就等接口恢复吧

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/health-checks Health Check functionality type/enhancement Proposed improvement or new feature
Projects
None yet
Development

No branches or pull requests

6 participants