Open MAS150MD200 opened 6 years ago
+1 suffering from the same issue
Same exact issue for me. Upgraded from Consul 1.0.0 to 1.1.0 and it totally broke my script checks.
Same issue here. Given the last registrator released was 2016, i highly doubt this will be fixed.
We encountered this issue too when upgrading - our CHECK_SCRIPT was curl a command to hit the actuator health endpoint in a spring boot application. We worked around this issue by using the CHECK_HTTP/S instead. I know this won't resolve the exact issue described above but I thought I would mention there is a potential workaround (depending on your use case) for others bitten by this issue
Try the master
tag of registrator.
@josegonzalez I tried switching using the master image when I first encountered this issue without any luck. I'm not at all familiar with go but from looking at consul.go it looks like the issue is in the buildCheck function - from looking at the payload example in the consul docs it looks like TTL is now mandatory, however that is not set if you specify check_script, chk_cmd, check_http or check_https.
Would a simple fix be to add something similar to the block of code that adds the interval/DefaultInterval? I'm happy to do a PR, thoughts?
Sure, that works for us.
I'm working on a PR for this, the consul API removed this command. It's also gone from the current Consul Go client.
See https://github.com/hashicorp/consul/commit/b73323aa429f6edcfdff3b951774ca6f296f2bc5 for the relevant commit on Consul v1.1.0.
PR https://github.com/gliderlabs/registrator/pull/643 submitted.
Bumping this issue - I'm seeing the same issue. I've got a standard ECS setup - Consul, Fabio, Registrator. We upgraded our Consul server and our Agents and now we're seeing this error.
I switched to the master branch but it had no effect - the error persists.
Same error message with consul 1.9.3
/etc/consul/consul.d/service_somename.json
{
"service": {
"name": "somename",
"id": "someid",
"port": 12346,
"address": "",
"meta": {"metakey": "metavalue", "metaotherkey": "othermetavalue"},
"check": [{"id": "true-id-check", "name": "true", "args": ["/bin/true"], "interval": "10s", "timeout": "2s"}],
"weights": {"passing": 10, "warning": 1},
"tags": ["primary"]
}
}
trying to register that service
root@xxxxxxxxx:~# consul services register /etc/consul/consul.d/service_somename.json
Error registering service "somename": Unexpected response code: 400 (Invalid check: TTL must be > 0 for TTL checks)
root@xxxxxxxxx:~# consul -v
Consul v1.9.3
Revision f55da9306
Same error message with consul 1.9.5
...
"checks": [
{
"id": "HAProxy",
"name": "HAProxy TCP on port 80",
"tcp": "127.0.0.1:80",
"interval": "10s",
"timeout": "1s"
},
{
"id": "NGINX",
"name": "NGINX TCP on port 8081",
"tcp": "127.0.0.1:8081",
"interval": "10s",
"timeout": "1s"
},
{
"args": ["sh", "/opt/checkit.sh"],
"interval": "15s",
"timeout": "20s"
}
]
...
# consul services register /etc/consul.d/app-01.json
Error registering service "web-app-01": Unexpected response code: 400 (Invalid check: TTL must be > 0 for TTL checks)
# curl -i -X PUT --data @/etc/consul.d/app-01.json http://127.0.0.1:8500/v1/agent/service/register
HTTP/1.1 400 Bad Request
Vary: Accept-Encoding
X-Consul-Default-Acl-Policy: allow
Date: Thu, 02 Sep 2021 17:17:07 GMT
Content-Length: 52
Content-Type: text/plain; charset=utf-8
Consul v1.9.5 Revision 3c1c22679
What version of docker are you running? Docker version 18.03.1-ce
What version of registrator are you running? gliderlabs/registrator:latest (v7)
What is the exact command you are running registrator with? docker-compose.yml
A log capture of all the docker events before, during, and after the issue.
Description of the problem: Registrator unable to register consul health check type:
script
for consul versions > 1.1.0How reproducible: Try to register the following health check
SERVICE_CHECK_SCRIPT=curl --silent --fail example1.com
for consul > 1.1.0 The same configuration works for consul 0.9.3.Actual Results: Health check isn't registered.
Expected Results: Health check should be registered in Consul.