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

Consul API does not return Script Check Definition #8309

Closed
volfco opened this issue Jul 14, 2020 · 2 comments
Closed

Consul API does not return Script Check Definition #8309

volfco opened this issue Jul 14, 2020 · 2 comments

Comments

@volfco
Copy link

volfco commented Jul 14, 2020

Overview of the Issue

I have a service, DemoService1, that uses a script health check (see service definition below). I expect this information to be presented to me from the API under the Definition field when querying the service.

This is not the case. Via the HTTP or Go api, the definition is undefined even when there is a script present.

Reproduction Steps

{
  "checks": [
    {
      "args": [
        "true"
      ],
      "interval": "5s"
    }
  ],
  "enable_tag_override": false,
  "id": "DemoService1",
  "name": "DemoService1",
  "port": 9110,
  "tags": [
    "TagC"
  ]
}

Register this service into Consul (I used 1.7.1), and run curl http://127.0.0.1:8500/v1/health/service/DemoService1 | jq against the API. I get the following response:

[
  {
    "Node": {
      "ID": "2741f075-4feb-4072-3946-bea439e9a318",
      "Node": "laptop4",
      "Address": "127.0.0.1",
      "Datacenter": "local",
      "TaggedAddresses": {
        "lan": "127.0.0.1",
        "lan_ipv4": "127.0.0.1",
        "wan": "127.0.0.1",
        "wan_ipv4": "127.0.0.1"
      },
      "Meta": {
        "consul-network-segment": ""
      },
      "CreateIndex": 5,
      "ModifyIndex": 6
    },
    "Service": {
      "ID": "DemoService1",
      "Service": "DemoService1",
      "Tags": [
        "TagC"
      ],
      "Address": "",
      "Meta": null,
      "Port": 9110,
      "Weights": {
        "Passing": 1,
        "Warning": 1
      },
      "EnableTagOverride": false,
      "Proxy": {
        "MeshGateway": {},
        "Expose": {}
      },
      "Connect": {},
      "CreateIndex": 44,
      "ModifyIndex": 298
    },
    "Checks": [
      {
        "Node": "laptop4",
        "CheckID": "serfHealth",
        "Name": "Serf Health Status",
        "Status": "passing",
        "Notes": "",
        "Output": "Agent alive and reachable",
        "ServiceID": "",
        "ServiceName": "",
        "ServiceTags": [],
        "Type": "",
        "Definition": {},
        "CreateIndex": 5,
        "ModifyIndex": 5
      },
      {
        "Node": "laptop4",
        "CheckID": "service:DemoService1",
        "Name": "Service 'DemoService1' check",
        "Status": "passing",
        "Notes": "",
        "Output": "",
        "ServiceID": "DemoService1",
        "ServiceName": "DemoService1",
        "ServiceTags": [
          "TagC"
        ],
        "Type": "script",
        "Definition": {},
        "CreateIndex": 44,
        "ModifyIndex": 298
      }
    ]
  }
]

I expect to get back the args and interval as defined in the service definition, but the object is empty. /v1/agent/checks provides an empty Definition as well.

@volfco
Copy link
Author

volfco commented Jul 14, 2020

Under Consul v1.3.0, I can poll /v1/agent/self and get this information, but this seems to be no longer present in v1.7.4. Consul v1.3.0 also has the same issue as mentioned above.

@freddygv
Copy link
Contributor

Hi, I'm going to close this as a duplicate in favor of #1680.

The following comment has a bit of context around why check definitions are not exposed via the API:
#7330 (comment)

As mentioned in that comment, you could store non-sensitive check definition arguments in the Notes field.

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

No branches or pull requests

2 participants