0

I am trying to register a health check with consul using the API but am having some major issues with it. When I go to register a health check I get the error of Missing check name but I am using the exact checks from the consul docs.

I have tried adding it at the same level as 'check' but that just makes all responses say there is no TTL for the check when it should only be asking for the TTL on a TTL check which this is not.

When I try to register a TTL check as well it gives similar errors (see below).

What should I do to resolve this?

script.json

{
  "check": {
    "id": "mem-util",
    "name": "Memory utilization",
    "args": ["/usr/local/bin/check_mem.py", "-limit", "256MB"],
    "interval": "10s",
    "timeout": "1s"
  }
}

ttl.json

{
  "check": {
    "id": "web-app",
    "name": "Web App Status",
    "notes": "Web app does a curl internally every 10 seconds",
    "ttl": "30s"
  }
}

Command/error message script check

consul@<node name>:/work-disk/consul$ curl -v -H "Content-Type: application/json" --header "X-Consul-Token: <token>"  --request PUT --data @script.json http://localhost:8500/v1/agent/check/register
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8500 (#0)
> PUT /v1/agent/check/register HTTP/1.1
> Host: localhost:8500
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Type: application/json
> X-Consul-Token: <token>
> Content-Length: 175
> 
* upload completely sent off: 175 out of 175 bytes
< HTTP/1.1 400 Bad Request
< Vary: Accept-Encoding
< Date: Fri, 09 Nov 2018 16:41:36 GMT
< Content-Length: 18
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
Missing check name

Command/error message ttyl check

consul@<node name>:/curl -v -H "Content-Type: application/json" --header "X-Consul-Token: <token>"  --request PUT --data @ttl.json http://localhost:8500/v1/agent/check/register
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8500 (#0)
> PUT /v1/agent/check/register HTTP/1.1
> Host: localhost:8500
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Type: application/json
> X-Consul-Token: <token>
> Content-Length: 145
> 
* upload completely sent off: 145 out of 145 bytes
< HTTP/1.1 400 Bad Request
< Vary: Accept-Encoding
< Date: Fri, 09 Nov 2018 16:43:32 GMT
< Content-Length: 18
< Content-Type: text/plain; charset=utf-8
< 
* Connection #0 to host localhost left intact
Missing check name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.