缺少支票名称

时间:2018-03-02 23:10:31

标签: consul

使用consul http api我在发布到API时在响应正文中得到Missing check name。我已阅读文档等但无法找到问题。有人有任何想法吗?

我将以下内容发布到http://localhost:8500/v1/agent/check/register

{
  "service": {
    "name": "component",
    "tags": [
      "aws_instance_id"
    ],
    "address": "127.0.0.1",
    "port": 80,
    "enable_tag_override": false,
    "node": "consulserver",
    "id": "test",
    "check": {
      "id": "health",
      "name": "HTTP API",
      "http": "http://localhost/health",
      "tls_skip_verify": false,
      "method": "GET",
      "interval": "10s",
      "timeout": "1s"
    }
  }
}

1 个答案:

答案 0 :(得分:0)

json是incorect,应该是

{
    "name": "component",
    "tags": [
      "aws_instance_id"
    ],
    "address": "127.0.0.1",
    "port": 80,
    "enable_tag_override": false,
    "node": "consulserver",
    "id": "test",
    "check": {
      "id": "health",
      "name": "HTTP API",
      "http": "http://localhost/health",
      "tls_skip_verify": false,
      "method": "GET",
      "interval": "10s",
      "timeout": "1s"
    }
  }